0

Whats wrong with the code

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner input = new Scanner(System.in); String name, surname, course; int studentNum , aps ,idnum ; double salary; name = input.nextString(); surname = input.nextString(); course = input.nextString(); studentNum = input.nextInt(); aps =input.nextInt(); idnum = input.nextInt(); salary = input.nextDouble(); System.out.println("your name is " + name ); System.out.println("yr surname is: " + surname); System.out.println("u doing which course " + course); } }

11th Mar 2022, 12:56 PM
Oratilwe Seleke
1 Answer
+ 4
next.String() isn't a valid method in Java. Try next() or nextLine() instead
11th Mar 2022, 1:40 PM
Simba
Simba - avatar