What is the right syntax to read an integer from the user in Java?
RPSC Programmer 2024
What is the right syntax to read an integer from the user in Java?
- A.
Scanner sc = new Scanner(System.in); int num = sc.readInt();
- B.
Scanner sc = new Scanner(System.in); int num = sc.inputInt();
- C.
Scanner sc = new Scanner(System.in); int num = sc.nextInt();
- D.
Scanner sc = new Scanner(System.in); int num = sc.getInt();
- E.
Question not attempted
Attempted by 290 students.
Sign up free to check your answer
Sign up freeLoading lesson…

