File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Difficult creating basic List method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Difficult creating basic List method" Watch "Difficult creating basic List method" New topic

Difficult creating basic List method

André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
Why does not compile? I have created the Bean of nomeAnimalDomestico and nomeAnimalSalvagem I wanted to add names into the list and after return all that...

André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
I realized I need to invoke by the Bean the required atribbutes... hehehe... But keep not working...
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3783

André Asantos wrote:lista.add(this.setNomeAnimalDomestico("Cachorro"));

Return type of setNomeAnimalDomestico method is void - means it doesn't return anything. The above statement attempts to get a return value from setNomeAnimalDomestico method and pass it to lista.add method.

Please CarefullyChooseOneForum when you ask a question
This forum is for posting sun certification results, moving this to the SCJP forum.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
subject: Difficult creating basic List method
It's not a secret anymore!