SOMETHING IS WRONG WITH MY CODE, IT GETS COMPILED BUT ONLY PROBLEM IS WHEN I INPUT THE NUMBERS THE OUTPUT COMES AS "Area@9664a1" !
// Implement a class Area which has three attributes length, breadth and Area. use attributes constructor to initilize length and breath. implement a method calcArea to calculate Area of Rectangle main body should instantiate object, callthe calcArea method and display the returned value.
class Area
{
double length;
double breadth;
double area;
Area(double l, double b)
{
length=l;
breadth=b;
}
void calcArea()
{
area=length*breadth;
}
}
class AreaTest
{
public static void main(String args[])
{
double length=Double.parseDouble(args[0]);
double breadth=Double.parseDouble(args[1]);
Area a=new Area(length, breadth);
a.calcArea();
System.out.println(a);
}
}