String name;
Int id;
String sex;
Computer Computer;
Void study () {
System. The out. Println (" I am using "+ computer. Brand +" knock on the code ");
}
Void play () {
System. Out.println (" I play the king!" );
}
Public static void main (String [] args) {
Student Student=new Student ();
Student. Name="Lou wai";
Student. Id=55;
Student. Sex="male";
Computer cod=new Computer ();
Cod. Brand="lenovo savior";
Student.com puter=cod;
Student. Study ();
}
}
The class Computer {
A String brand;
}
The Exception in the thread "main" Java. Lang. NoSuchMethodError: Java object-oriented. Computer: method & lt; init> (V) not found
The at Java based learning/Java object-oriented. Student. The main (Student. Java: 33)
CodePudding user response:
JdK1.8 tried, no problem