public class Main{
private int length;
private int width;
public void Main(int length, int width){
this.lenght = length;
this.width = width;
}
public int square(){
return length * width;
}
public static void display(String args[]){
Main u = new Main(3, 4);
System.out.println(u.square());
}
}这是什么原因呀?我刚学JAVA,有许多地方不明白,请指教 ^_^
private int length;
private int width;
public void Main(int length, int width){
this.lenght = length;
this.width = width;
}
public int square(){
return length * width;
}
public static void display(String args[]){
Main u = new Main(3, 4);
System.out.println(u.square());
}
}这是什么原因呀?我刚学JAVA,有许多地方不明白,请指教 ^_^
this.lenght = length;
this.width = width;
}