• 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

How can I go about adding an Object to another class Object?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am able to pull up the faculty list in the ArrayList, but how can I assign the choice (m) to the Course? Any help would be greatly appreciated. Thank you.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are going to have to provide a more detailed question. What is it exactly you are trying to do?

Hi, I am able to pull up the faculty list in the ArrayList,



What's the faculty list? There's a variable called "faculty" but it's not declared or initialized in the method. Is it type List? Is the faculty list "facultyChoice"?

but how can I assign the choice (m) to the Course?



What's the Course? You have an object of type Courses and you are passing m, which is null, to it.
 
Mike Lonsky
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nvm. I figured it out.
Thank you though.
 
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

We need the FacultyMember source to be able to answer your question.

Also, how are you going to decide which element of the List<FacultyMember> you are going to choose?

Is the FacultyMember the professor?

Anyway, it should go something like this given the list is your FacultyMember list:



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

Mike Lonsky wrote:Nvm. I figured it out.
. . .

Please tell us what the solution was. If anybody else searches for the same problem, they will then find the answer.
 
reply
    Bookmark Topic Watch Topic
  • New Topic