Motorクラスにcontructor(Motor)を作りたいのですが、Contructor1クラスで呼び出したいのですが、そうするとエラーが発生してしまいます...そしてその理由がわかりません。私はちょうど今週から Java を学んでいます。
これはコードです:
class Motor{
Motor(int type[]){
int input;
input=0;
type = new int[4];
for(int contor=0; contor<4; contor++){
System.out.println("Ininsert the number of cylinders:");
Scanner stdin = new Scanner(System.in);
input = stdin.nextInt();
type[contor] = input;
System.out.println("Motor with "+type[contor]+" cylinders.");
}
}
}
public class Contructor1 {
public static void main(String[] args){
Motor motor_type;
for(int con=0; con<4; con++){
motor_type = new Motor();
}
}
}