I am new at Java and lately I study class and object topics. However, I could not progress of this code:
public class ClassStudy {
// Student Group
class Student {
public String name = null;
public String surname = null;
boolean study(boolean does) {
// He studies.
boolean d = does;
return d;
}
boolean slackOff(boolean does) {
// He slacks off.
boolean d = does;
return d;
}
}
// Teacher Group
class Teacher {
public String name = null;
public String surname = null;
boolean teach(boolean does) {
// He teaches.
boolean d = does;
return d;
}
boolean learn(boolean does) {
// He learns.
boolean d = does;
return d;
}
}
// Main Method
public static void main(String[] args) {
Student student = new Student();
Teacher teacher = new Teacher();
}
}
In main method, I got errors of student, yet did not got of teacher. I do not know if I have done any mistake or I can not see it. What has to be done?
The errors I get:
- The value of the local variable student is not used
- No enclosing instance of type ClassStudy is accessible. Must qualify the allocation with an enclosing instance of type ClassStudy (e.g. x.new A() where x is an instance of ClassStudy).
- Line breakpoint:ClassStudy [line: 44] - main(String[])