I’m trying simple things in eclipse, previously used tmcbeans for the moocfi course.
I want to print the user input as a number, but I get two errors:
- import java.lang.Integer cannot be resolved (l.2)
- Integer cannot be resolved (l.9)
import java.util.Scanner;
import java.lang.Integer;
public class MyFirstProgram {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Hello world!");
scan.nextLine();
int x = Integer.valueOf(scan.nextLine());
System.out.print(x);
}
}
Tried searching for answers, but they didn’t work
2