+ 3

in c program we write scanf statement .what we have to take in java to read the statement??

27th Dec 2016, 11:40 AM
kavya
2 Respostas
+ 2
To read a string in JAVA , we either use BufferedReader or Scanner . Using Scanner : Scanner sc=new Scanner (System.in); String x=sc.next(); you are ready to input the string now . btw BufferedReader is better way to take input .
16th Oct 2017, 4:10 PM
Deepesh Pandey
Deepesh Pandey - avatar
0
Scanner scanner = new Scanner(System.in); scanner.<appropriate method>
4th Jan 2017, 4:59 PM
Abhilash Kumar Vedwan
Abhilash Kumar Vedwan - avatar