• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 7123
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: 76862
366
  • 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