Search This Blog

15 June, 2011

Simple Java program 6

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


class aaa
{
final private int a;

private int b;
public void sam()

System.out.println(a); 

}

aaa()
{
a=7;
}
aaa(int e)

{
b=e;
}
}

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

}



O/P:- Error will generate because x is not assigned in parameterized constructor.
----------------------------------------------------------------------------------------------

No comments:

Post a Comment

Meetme@