Horje
how to take input in java Code Example
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 
java get input
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = sc.nextInt();
double d = sc.nextDouble();
float f = sc.nextFloat();

// more fast way
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine(); // read line
int c = br.read();        // read single char
java get input

import java.util.Scanner; 
//...
Scanner scan = new Scanner(System.in);
String s = scan.next();
int i = scan.nextInt();





20

Related
java scanner stack overflow Code Example java scanner stack overflow Code Example
java date time Code Example java date time Code Example
java hashmap entryset Code Example java hashmap entryset Code Example
java iterate through hashmap Code Example java iterate through hashmap Code Example
check jdk version windows 10 cmd Code Example check jdk version windows 10 cmd Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11