In java, there are different ways to accept input from user, we can also accept input from user in java using scanner class. scanner class is a predefined class in java.util package, and we can type cast input in different data type.
// Java program to accept input from user using Scanner class.
import java.util.Scanner;
class GetInput
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int a,b,c;
a = in.nextInt();
b = in.nextInt();
c=a+b;
System.out.println("SUM : "+c);
}
}
It is hard to come by experienced people about this subject, but you seem like you know what you are talking about! Thanks