Use of more than one class in a java program.
class Room
{
float len,brd;
void getdata(float x,float y)
{
len=x;
brd=y;
}
}
class CalArea
{
public static void main(String args[])
{
float area;
Room obj=new Room();
obj.getdata(10,15);
area=obj.len*obj.brd;
System.out.println("The area of Room is : " +area);
}
}
OUTPUT
0 comments:
Post a Comment