Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners What is the difference between a static and a non-static inner class?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
What is the difference between a static and a non-static inner class?
1 Answer(s)      a year and 8 months ago
Posted in : Java Beginners


Hi,

What is the difference between a static and a non-static inner class?

Thanks


Advertisement
View Answers

April 16, 2013 at 3:53 PM


Hi friend,

Java facilitate to write a class within another class called Nested class. Nested class is of two types static and non-static. Static nested class is a class which is declared using 'static' keyword and the non-static classes are called inner/non-static nested class.

Non-static nested class have full access of all the members inside which it is nested whereas, static nested class can't invoke non-static methods or access non-static fields of an instance of the class within which it is nested.

For more detail please go through the following link

http://www.roseindia.net/java/master-java/Static.shtml

http://www.roseindia.net/help/java/n/java-nested-class.shtml

http://www.roseindia.net/java/master-java/inner.shtml



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com