• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

inner class marked protected

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
Marcus Greens mock ( http://www.jchq.net/mockexams/exam2.htm ) has following question:
---
Question 57)
Which of the following statements are true?
1) Adding more classes via import statements will cause a performance overhead, only import classes you actually use.
2) Under no circumstances can a class be defined with the private modifier
3) A inner class may under some circumstances be defined with the protected modifier
4) An interface cannot be instantiated
---
It is clear that option 3 is right but what actually means "under some circumstances"? I think I would cut it out.

------------------
Antti Barck
It Solutions Consultant, NSD Oy
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Take a look at the follwing code.
<code>
public class test{

void aMethod(){
class innerClass{
// In a method variables and classes cannot be marked with access modifiers
}
}
}
</code>
Correct me if I'm wrong
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think "under some circumstance" means sometimes it can be defined as protected. Since for top-level class, we cannnot define it as protected, but for inner class, we might define it as protected.
Correct me if i am wrong.
Guoqiao
 
reply
    Bookmark Topic Watch Topic
  • New Topic