Java program to implement concept of Inner Class

Simple Java program to implement use of Inner Class

Code:

class Outer{

private int data=30;

class Inner{

void msg(){System.out.println("data is "+data);}

}

}



class innersample{

public static void main(String args[]){

Outer obj=new Outer();

Outer.Inner in=obj.new Inner();

in.msg();

}

}

Comments

Popular posts from this blog

C program to evaluate Prefix Expression using Stack data structure

Java Program to Implement sorting algorithm using TCP on Server application

C++ program to perform data transformation Min-max and Z score Normalization