Well, in this case the car
variable will be null
, so dereferencing it (as you do when you access car.length
) will throw a NullPointerException
.
In fact, you can't access that variable at all until some value has definitely been assigned to it - otherwise the compiler will complain that "variable car might not have been initialized".
What is it you're trying to do here (it's not clear to me exactly what "solution" you're looking for)?