Search This Blog

15 June, 2011

Simple Java program 10

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


class aaa
{

private int a;

public void setwattage(int e)

w=e; 

}

public void printinfo()

{
System.out.println("Wattage is  "+w)
}
}
class psp
{
public static void main(String aa[])
{
aaa x;
x=new aaa();
x.setwattage(60);

x.printinfo();

}



O/P:- Wattage is 60


-------------------------------------------------------------------------

1 comment:

  1. i need a solution to a java real life program...
    if you are there to help me...
    plss mail me.. my id is - kind2all.charmi@gmail.com..
    i hope i will get your soon reply...!!!
    thank you

    ReplyDelete

Meetme@