Published
- 1 min read
how to take input in java
The solution for this is noted below
how to take input in java
Solution
Scanner sc = new Scanner(System.in); // Create a Scanner object
String userName = sc.nextLine();//read input string
int age = sc.nextInt(); //read input integer
long mobileNo = sc.nextLong(); //read input long
double cgpa = sc.nextDouble(); //read input double
System.out.println(userName);//output
Try other methods by searching on the site. That is if this doesn’t work