0
How to take the user input as a string and print the output as name = user input in java
I have wrote like this :- import java.util.scanner; public class sai{ public static void main{ Scanner scanner = new scanner(System.in); String name = String.next(); System.out.println("name = "+name); } } It is taking two inputs from user I am not getting where I am doing the mistake
2 Answers
+ 2
Sai Eshwar you made a few errors such as not capitalizing Scanner in the import
and in the String name = scanner.next();
Here is some corrections as mentioned
https://code.sololearn.com/cW70cJrEUwhy/?ref=app
0
Thank u bro.
Can u tell me how to code if the input is taken from the user string input for name, float numbers as input from users for 3 subjects and should print the Total and average. And the class object is TotalandAvg