• 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

Constructor of Class not working in Class List of another Class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize that the very twisted title!

So right now I have a class called "Person" that looks like this:


As you can see I have an ArrayList of Student(s) in my Person class. It however, will not let me initialize a new person in the ArrayList<Student> using the Student constructor. My Student class looks like this.



Am I initializing a student the wrong way?
Thank you.
 
Beckah Sheeler
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Figured it out! Forgot to initialize the !

Just added and I was golden
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Beckah Sheeler wrote:As you can see I have an ArrayList of Student(s) in my Person class. It however, will not let me initialize a new person in the ArrayList<Student> using the Student constructor.


Yes, but your array AND your class are both called 'Student'. Since you didn't give us the error you got, I'm not sure that that's the actual problem; but it IS a potential one. Class name start with capital letters; field (and method) names should start with SMALL ones.

HIH

Winston
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic