Scanner class programs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Scanner class programs

a program to print two no's

7th Dec 2016, 6:38 AM
Vidisha Sharma
Vidisha Sharma - avatar
1 Answer
0
public static void main(String agrs[]){ Scanner s = new Scanner(System.in) //import scanner class to take input from user int number1= s.nextInt(); //prompt user to input first number int number2= s.nextInt(); //prompt user to input Second number System.out.println(number1 +" "+number2); }
9th Dec 2016, 10:06 AM
Vishesh Awasthi
Vishesh Awasthi - avatar