Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Java Part 2
« Previous
Next »
The inner class can access private members of the outer class
Options
- False
- True
CORRECT ANSWER : True
Discussion Board
InnerClass
Inner class is always associated with an instance of its enclosing class having the methods and variables also intact. As it has the direct access to the object's methods and fields. So, inner class of a class can access the members of the outer class. Inner class is also associated with an instance, it cannot define any static members itself.
Inner class object's instances exists within an instance of outer class. For example:
class OuterClass {
...
class InnerClass {
...
}
}
Instance of an InnerClass can only exist within an instance of OuterClass and always has the direct access to the methods and fields of its enclosing instances.
Rohit Sharma 08-7-2014 06:50 AM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
Java Beginner (11)
Java (39)
Java (40)
Java (22)
Java (30)
Java (25)
Java (20)
Java (20)
Core Java (20)
Core Java (10)
Core Java (72)
EJB (20)
JDBC (20)
Applet (20)
Struts (21)
Servlets (20)
Java Web Services (20)
Javascript (40)
J2EE (10)
jQuery (46)
Advertisement
▲