0

how to get input from keyboard

scanner

21st Sep 2016, 9:05 AM
Jafar Ali
Jafar Ali - avatar
2 Réponses
0
you get input from keyboard using Scanner class, to use scaneer class you should have to import java.util package in your program. than create the object of scanner class and use this object to get input from keyboard
21st Sep 2016, 9:10 AM
Pradeep Saini
Pradeep Saini - avatar
0
Example import java.util.Scanner; <<< This very importrant! public class Scan { public static void main(String[] args) { Scanner klavye = new Scanner(System.in); System.out.println(“Enter number”); int a = klavye.nextInt(); int b = klavye.nextInt(); System.out.println(“Total=”+(a+b)); } }
21st Sep 2016, 9:44 AM
HawkEye
HawkEye - avatar