- 1

how to read the input from user...?

explain the all ways to read the input. Thanx in advance.

16th Oct 2016, 11:42 AM
Jamaltheen S
Jamaltheen S - avatar
2 Answers
+ 3
By use scanner like this code . Above and outside the class write import java.util.Scanner; ✹ Then inside the main method write Scanner input = new Scanner (System.in); int x = input.nextInt (); System.out.println(x); > this program for read integer number from user then store it in x variable after that print x * if you want to enter others like string use this statement : String s = input.nextLine();
16th Oct 2016, 2:47 PM
Duaa Sa
Duaa Sa - avatar
+ 1
Some options create a obj Scanner or use JOptionPane
16th Oct 2016, 11:46 AM
Wanderlei Borges
Wanderlei Borges - avatar