public class main{
Program program = new Program();
Scanner in = new Scanner(System.in);
switch (button) {
case 1:
String numOfCar=in.nextLine();
String name=in.nextLine();
String tell=in.nextLine();
program.addDriver((numOfCar),(name),(tell));//тут подчеркивает ошибка<img src="https://habrastorage.org/webt/63/81/f9/6381f95d80af8607094882.png" alt="image"/>
break;
}
public class Program {
public static void addDriver(Driver numberOfCar,Person fullName, Person numberOfTell){
//Scanner in = new Scanner(System.in);
Driver driver4=new Driver(numberOfCar);driver4.fullName=fullName.toString();driver4.numberOfTell=numberOfTell.toString();
System.out.println("Дані нового водія:");
System.out.println(driver4.numberOfCar+"-"+driver4.fullName+"-"+driver4.numberOfTell);
}
}
public abstract class Person {
public String fullName;
public String numberOfTell;
}
public class Driver extends Person{
public String numberOfCar;
}