I keep getting errors in my very short, simple code. I'm not sure what is wrong, can you please help me out?
Code:
import java.util.Scanner;
public class Driver {
private int age, carValue, tickets;
public getInfo(){
Scanner in = new Scanner(System.in);
System.out.println("Enter Age: ");
age = in.nextInt();
System.out.println("Enter Car Value: ");
carValue = in.nextInt();
System.out.println("Enter the number of tickets you have: ");
tickets = in.nextInt();
}
}
This is my main:
class Main
{ public static void main(String args[])
{
Driver john;
john = new Driver();
john.getInfo();
}
}
My errors are:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method getInfo() is undefined for the type Driver
at Main.main(Main.java:6)
Ok, I have updated it now, and I still get errors.
void