aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Declaration and Access Control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic

Declaration and Access Control

Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

Hi friends...
I am having a problem in understanding why this code is giving error. Please help...

Astha - OCPJP 6 (90%)
Ankit Garg

Joined: Aug 03, 2008
Posts: 9327

Your code is missing curly brackets for the main method...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

oops...i did it by mistake :O
but if i am putting curly brackets, then also its giving an error. Let me post the modified code in new thread.
Aniket S. Kulkarni
Ranch Hand

Joined: Jun 15, 2011
Posts: 87

Ankit Garg is right and in println you are calling method without creating the object of Hobbit class.

Aniket Kulkarni
Oracle Certified Professional, Java SE 6 Programmer.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42954
continued here

Next time, you can just continue the discussion in the same topic, as it is about the same subject.
Have you tried LearnNowOnline?
subject: Declaration and Access Control