Hello, there was a problem compiling the project. It is necessary to create a class and its successor and an overridden method. Next to each class, it writes class ... is public name and it offers to rename the file. How I understand the problem is that the classes had to scatter in different files? But I read that it is possible to keep several in one. Help me please.
package l2; public class Man { int age; double weight; String name, gender; public Man (int age, double weight, String name, String gender) { this.age = age; this.weight = weight; this.name = name; this.gender = gender; } public int ageChanged (int n_a){ age = n_a; return age; } public double weightChanged (double n_w){ weight = n_w; return weight = n_w; } public String nameChanged (String n_n){ name = n_n; return name; } } public class Student extends Man { int y_of_s; public Student (int age, double weight, String name, String gender, int y_of_s){ Super (age, weight, name, gender); this.y_of_s = y_of_s; } public int y_of_sChanged (int n_y_of_s){ y_of_s += n_y_of_s; return y_of_s; } public int ageChanged (int n_a){ age += n_a; return age; } } public class Main { public static void main(String[] args) { Student p1 = new Student (18, 67.3, "Anton", "male", 2016); Man p2 = new Man (45, 67.3, "Jack", "male"); System.out.println("Возраст p1: "+p1.age+"; год обучения p1: "+p1.y_of_s+";"); System.out.println("Возраст p2: "+p1.age+";"); System.out.println("Возраст p1 (новый): "+p1.ageChanged (1)+"; год обучения p1 (новый): "+p1.y_of_sChanged (1)+";"); System.out.println("Возраст p2 (новый): "+p1.ageChanged (46)+";"); } }