Quantcast
Channel: solving NullPointerExceptions - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Doodad for solving NullPointerExceptions

You're doing thisCompetitor[] competitors = new Competitor[n];for(Competitor c : competitors) { c = new Competitor(); System.out.println("Enter name, id and bounce height"); c.SetName(sc.next());...

View Article



Answer by johnchen902 for solving NullPointerExceptions

This enhanced for loop:for(Competitor c : competitors) { c = new Competitor(); System.out.println("Enter name, id and bounce height"); c.SetName(sc.next()); c.SetId(sc.next());...

View Article

Answer by Fedy2 for solving NullPointerExceptions

The Create method initializes the competitors values in the wrong way. Try this: for(int i = 0;i<competitors.length;i++){ competitors[i] = new Competitor(); System.out.println("Enter name, id and...

View Article

solving NullPointerExceptions

I have been studying Java since last week (I have basic knowledge in C#) and now I am practicing classes.I don't understand why I get this exception, I tried to change the code many times and nothing...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images