Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from marcus green mock exam

 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1) Compile Error: Methods in Base not found
2) Compile Error: Unable to access protected method in base class
3) Compilation followed by the output "amethod"
4)Compile error: Superclass Class1.Base of class Class1.Class1 not found

Ans given is 4
but i cheked ,it compiles & runs fine with o/p amethod.Shouldn't the answer be 3?
Thanks
Veena
[ Jess fixed the code so you can actually read it, please be more careful when cutting and pasting code so that we can read it and help! ]
[ October 20, 2003: Message edited by: Jessica Sant ]
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Veena, can you make it more readable? I had hard times reading the code.
These classes are in different packages, Base.java is marked as default access, and, to make things worse, package Base is not imported into Class1.java. This shouldn't compile.
P.S. Thanks Jess, I thought it was local on my computer.
[ October 20, 2003: Message edited by: Vad Fogel ]
[ October 20, 2003: Message edited by: Vad Fogel ]
 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh!I got it.Thanks and really sorry for pasting code as it is.
Thanks
Veena
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic