File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question from anilbachi scjp suit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question from anilbachi scjp suit" Watch "question from anilbachi scjp suit" New topic
Author

question from anilbachi scjp suit

suman bingi
Greenhorn

Joined: Nov 19, 2000
Posts: 21
Hi all,
this is a question from anilbachi scjp suit please explain me of the solution


Thank you.
suman
mahesh jhamtani
Greenhorn

Joined: Jan 12, 2001
Posts: 11
I think answer will be compile time error.
Child class cannot override a method in parent class if it is more restrictive then parent class method.
In parent class method sample has public access, while in child class it has default access.
Please correct me if I am wrong.
Thanks.
sam pitt
Ranch Hand

Joined: Mar 07, 2001
Posts: 48
Hi Suman Bingi,
I thought you have passed the cert. See your posting
http://www.javaranch.com/ubb/Forum24/HTML/006948.html
Have you started studying again from Anil's website? :-)
-sam pitt
suman bingi
Greenhorn

Joined: Nov 19, 2000
Posts: 21
hi pit,
ur first post seems interesting, Iam now preparing a collection of questions so Iam refreshing back all the material i have, and double checking them all,
any problems!!!
suman.
Pratap Reddy
Ranch Hand

Joined: Jan 05, 2001
Posts: 36
Hi Suman ,
Rules of overriding is you can't make the method much
protected.
Private ---> friendly ---> protected ---> public.
But in your example public void sample() is overriding with void sample(). That not possible. It gives compiler error.
sam pitt
Ranch Hand

Joined: Mar 07, 2001
Posts: 48
hello suman bingi,
I have no problems....
Just do not make it so obvious that other people start
noticing it !!
sam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question from anilbachi scjp suit