• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inner class declared

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following statements are true regarding Inner
Q1
classes or class where they are declared and instantiated.
new SimpleInterface(){} ans : true
new ComplexInterface(){} ans :true
Myclass extends Object {} ans : true
new Myclass extends Object {} ans: false
abstrct class inner ans: true
private class C ans: true
new MyInterface(x) {} ans: false
am i correct??
Q2
1. inner class can be instantiated only in it's enclosing class ans:false
2. they can be accessed only within the enclosing class ans:false
3. they cannot implement interface ans: false
4. they can access final varaibles and final methods within their declaration
scope ans:true
5. Top level nested clas need not be instantiated: true
am i right.pls explan?
 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ken,
In ur first ques. u got it all right except

Myclass extends Object {} : ans is false
because the word class is missing.
the correct declaration should have been
class Myclass extends Object {}


as far as secon ques goes for the first 4 options I agree with u.
but option 5) i cud not get what does it mean?
regards
deekasha
 
reply
    Bookmark Topic Watch Topic
  • New Topic