Search This Blog

15 June, 2011

Simple Java program 5

5. Simple Java programs to know what 
    output  will be.


class aaa
{
final private int a;
public void sam()

System.out.println(a); 

}

aaa()
{
a=7;
}


}

class psp
{
public static void main(String aa[])
{
aaa x;
x=new aaa();
x.aaa();

}



To execute above program:-
C:\jdk1.6\bin>javac h.java     (h is saved name of this program)
C:\jdk1.6\bin>java psp

O/P:- 7  

No comments:

Post a Comment

Meetme@