• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interesting inner Classes Check inside

 
Hussain
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
salam(hi) all ranches,
Hope every budy fine and doing Java.
AS i m preparing for the exam i just come to know tht intersting thing.as everybudy Know tht we cant use abstarct and private both I do.
E.g...
class A
{
static private abstarct class B//as inner class can be private
{
}
}
class A
{
class B
{
final static int i=0;//compile as i is a compile time constant
}
}
class A
{
class B
{
final static int i=a();
//won't compile as i is not compile time contant

}
static int a()
{
return 1;
}
}
interesting!
U c the power of Final variables both inside and outside the method
------------------
Muhammad Hussain
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic