Answers for "how to read and write input in java"

6

java taking console input

String str = System.console().readLine();
Posted by: Guest on April-01-2020
34

how to take input in java

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
Posted by: Guest on May-03-2020

Code answers related to "how to read and write input in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language