how to input in java
import java.util.Scanner;
...
Scanner console = new Scanner(System.in);
int num = console.nextInt();
console.nextLine() // to take in the enter after the nextInt()
String str = console.nextLine();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
Also in Java:
- java simple jframe example
- simple javascript to detect browser using java utils
- java how to print a newline
- java find if element of list in present in another list
- split method in java
- java split for multiple characters
- find the day of the week Calendar class in java
- Building a maven EAR project and specifying the configuration of which projects to include, what is the element in the plugin configuration that contains Enterprise Java Bean Projects:
- java stream sort Collator
- android image view showing rotate image
- Java array multidimensional hashcode
- Unhandled exception: java.lang.InterruptedException
- java file download
- jframe border
- java self signed certificate truststore
- set color of text for jlabel
- JavaFX mouse over effe
- java android edit text set value
- how to input in java
- print a list java
- treeset java descending order using comparator
- int java
- java return new instance of generic type
- map multiple fields from java stream