Naulej kumar
Java InnerClass
1 Answer(s)      4 years and 9 months ago
Posted in : Java Beginners

How can we use Inner Class in java program?


View Answers

June 15, 2012 at 4:34 PM

public class InnerClassExample{
    class InnerClass{
        String name = "Naulej";     
        public String toString() {
            return super.toString();

    public InnerClassExample(){
        InnerClass innerClass = new InnerClass();
    public static void main(String[] args){     
        new InnerClassExample();        


[email protected]

Description:- The above code demonstrates you an Inner Class. An inner class is a class defined inside another class. Here, we have created a class named InnerClassExample and inside it, we have defined another class named InnerClass. Inside this class, we have created a toString method which return the string to its object.

Related Tutorials/Questions & Answers:
Java InnerClass
Java InnerClass   How can we use Inner Class in java program?   public class InnerClassExample{ class InnerClass{ String name...(); } } public InnerClassExample(){ InnerClass innerClass = new InnerClass
innerclass and database - Java Beginners
innerclass and database  program using innerclass to implement numerical bisection operation to call a procedure to store and update data in a database
Java nested class example
Java nested class example  Give me any example of Nested Class.  ... Class"; //NestedClass instance variable InnerClass innerClass = new InnerClass(); void getOuterS(){ System.out.println(outer); } void
java - Java Interview Questions
java  1.what is the diffrence between length and length()? 2.write aprogram by using static block? 3can interface have an innerclass
SCJP Module-3 Question-8
InnerClass(); } OuterClass() { System.out.print(s); } class InnerClass { String s = "InnerClass"; InnerClass() { System.out.print(s... compile error. 2. Prints : OuterClass InnerClass 3. Prints : OuterClass 4
Java Nested Class
Java Nested Class         In Java programming language, when a class is defined within another... of Java that is included in jdk1.1. The reasons of why we use nested classes
Inner class in java
Inner class in java In this example we will describe inner classes in java.... Inner classes provides an graceful and powerful feature to the Java. Inner...:- This class is defined within a block of Java code so like a local variable
inner class - Java Interview Questions
Java Inner Class  How many classes we can create in an inner class... to the requirement there is no limit . In Java programming language, when a class is defined... are a feature of Java that is included in jdk1.1. The reasons of why we use
Inner Class - Java Beginners
, it will generate two classes, Outer.class & Outer$Inner.class. But If I change the access
SCJP Module-3 Question-2
[] args) { 3 OuterClass.InnerClass i = new InnerClass(); 4... OuterClass { 8 public int x = 9; 9 public OuterClass() { 10 InnerClass inner = new InnerClass(); 11 inner.innerMethod(); } 12 class InnerClass { 13 public
java  diff bt core java and java
java  what is java
Java   Whether Java is pure object oriented Language
java  different between java & core java
java  explain technologies are used in java now days and structure java
java   why iterator in java if we for loop
JAVA  how the name came for java language as "JAVA
java  what is java reflection
java  is java open source
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
Java  how to draw class diagrams in java
java  explain object oriented concept in java
Java   Whether Java is Programming Language or it is SOftware
java  what are JAVA applications development tools
java  why to set classpath in java
java  give a simple example for inheritance in java
java  Does java allows multiline comments
java   What is ?static? keyword
java  write a java program using filenotfoundexception
java   difference between class and interface