• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

class NullPointerException? Can someone please help me?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



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
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, how do I give the passenger class a constructor? Can someone please give me a simple example?
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic