wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes class NullPointerException? Can someone please help me? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class NullPointerException? Can someone please help me?" Watch "class NullPointerException? Can someone please help me?" New topic
Author

class NullPointerException? Can someone please help me?

Matt Hazan
Greenhorn

Joined: Jan 27, 2011
Posts: 29



Hello,
So I declared this class in my program, I am basically trying to use it as a 'struct'. I am trying to create an array of type 'Info' which will store information about different people, so I can use it later. The program currently compiles however, I am getting a NullPointerException. Can anyone please help me understand how to fix this and why this is happening? ( i know that it is probably b/c something is not initialized correctly, or something is equal to null such as my array maybe?)

I am really having a hard time fixing this, any help will be greatly appreciated!

Thanks.

Matt Hazan
Greenhorn

Joined: Jan 27, 2011
Posts: 29
Also, how do I give the passenger class a constructor? Can someone please give me a simple example?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Are there structs in Java? Are they even called structs? That's your previous thread, with exactly the same cause of your problems, and I've already given you the answer in it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Matt Hazan wrote:Also, how do I give the passenger class a constructor? Can someone please give me a simple example?

http://download.oracle.com/javase/tutorial/java/javaOO/constructors.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class NullPointerException? Can someone please help me?
 
Similar Threads
Are there structs in Java? Are they even called structs?
accepting user input into into an array
Help with creating a game.
problems with math methods
getting NullPointerException