Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

Declaration and Access Control

Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 245


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


Astha - OCPJP 6 (90%)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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: 245

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.
thanks
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
Marshal

Joined: Mar 22, 2005
Posts: 41109
    
  45
continued here

Next time, you can just continue the discussion in the same topic, as it is about the same subject.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Declaration and Access Control
 
Similar Threads
Declaration and Access Control
why can't a function be called from a static context
kathy sierra question doubt scjp 1.6
Help on this SCJP question
A spurious code ???