This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Static Inner Class  RSS feed

 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


a. Prints: 3,2
b. Compilation error (i is not accessible)
c. Prints: 3,3
d. There are e.length instances of class ExInner.
e. ExInner is called a "top-level nested-class"

What will be the ouptut for the above program?
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Is this only a mistake or
does it belong to the trick of the question?

Would be Ex[] e=new Ex[2] ?
 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. Asusual some unusual typing mistakes!!!
 
amit smal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
yes there is an error in that line..
it should be
Ex e[] = new Ex[2];

and the output will be 3,3 since innner class being ststic can be instantiated once.

Regards,
Amit.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!