Tuesday, January 27, 2015

Use of more than one class in a java program.

http://indiancomputerwizard.blogspot.in/search/label/Java
http://indiancomputerwizard.blogspot.in/search/label/JavaUse 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

Blog Archive