Home Help Java I Inner Classes In Java
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Inner Classes In Java

Advertisement
There are 4 kind of classes that can be defined in a Java program, roughly can be termed as the inner classes.

Inner Classes In Java

     

There are 4 kind of classes that can be defined in a Java program, roughly can be termed as the inner classes.

--  Inner classes provides an elegant and powerful feature to the Java programming language. 
-- These inner classes are referred by different names in different situations. 

-- They are summarized here:
  1.
Static member classes
  2. Member classes
  3. Local classes
  4. Anonymous classes

-- The term "nested classes" sometimes refers to these inner classes.

Static member classes

  --
This class (or interface) is defined as a static member variable of another class.

Member classes

--  This is sometimes defined as a non-static member of an enclosing class. This type of inner class is analogous to an instance method or field.

Local classes

-- This class is defined within a block of Java code so like a local variable, it is visible only within that block.

Anonymous classes

-- An anonymous class is a  local class having no name; 
-- Syntactically it combines the syntax required for defining a class and the syntax required to instantiate an object. 

 
Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 11, 2009

Ask Questions?    Discuss: Inner Classes In Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com