Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
JavaQ5b
//JAVA LAB Q5-B-Write a Java Program to demonstrate use of nested class. //-------------------INNER NESTED CLASS------------ import java.util.*; import java.lang.*; class OuterClass { // static member static int outer_x = 10; // instance(non-static) member int outer_y = 20; // private member private int outer_private = 30; // inner class class InnerClass { void display() { // can access static member of outer class System.out.println("outer_x = " + outer_x); // can also access non-static member of outer class System.out.println("outer_y = " + outer_y); // can also access private member of outer class System.out.println("outer_private = " + outer_private); } } } class Rextester { public static void main(String args[]) { OuterClass outerObject = new OuterClass(); OuterClass.InnerClass innerObject = outerObject.new InnerClass(); innerObject.display(); } }
run
|
edit
|
history
|
help
0
Loop from 5 to 15
1
Zombie virus
Main.java
calc exp gxb2
Java Constructors
Fibonacci numbers 0 - 94
contoh 43
jb12.0 threads.enums
2 dimensional array (filled in by the user)