Avatar of surfsista9
surfsista9

asked on 

Accessing methods from an array of classes

I know this is probably a no brainer...but it's my very first program.

I defined an array of classes and when I try to access methods by subscript, I get a null pointer exception...seems easy, why not working?

Car[] cars = new car[args.length];
for (int r=0; r<cars.length; r++) {
           cars[0].goFast();
}
Java

Avatar of undefined
Last Comment
Mick Barry

8/22/2022 - Mon