Home | Need Help? | Archives
December 15, 2010 2:17 am
In my last post I have discussed about Float Type variable and how to add two float type variable.
Here I will share you about how to use and call a class from another class in Java.
Here is the example:
class Room
{
float length;
float breadth;
void getdata(float a, float b)
{
length=a;
breadth=b;
}
}
class RoomArea
{
public static void main(String args[])
{
float area;
Room room1=new Room();
room1.getdata(14,10);
area=room1.length*room1.breadth;
System.out.println(“Area:”+area);
}
}
Posted by allaboutbasic
Categories: Java Basic Problems
Tags:
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.
thanks for grow my knowledge
LikeLike
By Harish Nath Swami on January 5, 2019 at 8:42 pm
very good explanation
LikeLike
By vasu on January 26, 2019 at 5:30 pm