GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  Programming  >  Java

 Print  |  
Question:  what are advantages of using Innerclasses



April 04, 2006 11:06:19 #1
 Karthik   Member Since: Visitor    Total Comments: N/A 

RE: what are advantages of using Innerclasses
 

First,The main purpose of inner class as the name implies.,ie., not to have as a seperate class.

There may be situations where you need a helper sort of class which is very specific for a single class.In that case it may not be very good to have a seperate-independent class and give it a big figure. Instead embedd the class within the class that requires the innerclass' functionality.

The main advantage is the inner class can share a intimate relationship with the outer class.(it can access its private variables)

     

 

Back To Question