Input in java using Scanner class

import java.util.Scanner;
class Home{
	public static void main(String args[]){
		Scanner s=new Scanner(System.in);
		int x, y, z;
		System.out.println("Enter first number:");
		x=s.nextInt();
		System.out.println("Enter second number:");
		y=s.nextInt();
		z=x+y;
		System.out.println("Sum:"+z);
	}
}
© 2016 - 2022, All Rights are Reserved.