ghazalghorabi / TDA553-lab1

0 stars 0 forks source link

CRITICAL: Instance variables must be initialized by end of constructor (either in constructor or in declaration) #21

Closed martinjonsson01 closed 1 year ago

martinjonsson01 commented 1 year ago

It's important that an object is left in a valid state after construction. If you leave some instance variables null after construction, then a method could call these instance variables without knowing they're null, which results in a NullPointerException.

https://github.com/ghazalghorabi/TDA553-lab1/blob/f6df43632a9ae64de64547bebdc0acb4455e2fc4/src/CarShop.java#L15