public class Rectangle {
private double length;
private double breadth;
public void Rectangle(){}
public Rectangle(double length, double breadth){ this.length = length;
this.breadth = breadth;
}
public void setLength(double length){
this.length = length;
}
public double getLength(){
return length;
}
public void setBreadth(double breadth){
this.breadth = breadth;
}
public double getBreadth(){
return breadth;
}
public double calcArea(){
return length * breadth;
}
public String toString(){
return "Area of rectangle is " + calcArea();
}
}
public class RectangleTest {
public static void main(String[] args) {
Rectangle rtg = new Rectangle(10, 5);
System.out.println(rtg.toString());
}
}
here is my problem, if i put "void" on the green colour statement,
the RectangleTest cannot be execute due to some problems that i don't know,
if i remove the void is can be execute smoothly already, i want to know why?
what is the differences between with void and without void?