Import Public Class Public Static Void Int New: "Enter First Integer: "
Import Public Class Public Static Void Int New: "Enter First Integer: "
Scanner;
public class AddNumbers
{
public static void main(String args[])
{
int x, y, z;
System.out.println("Enter first integer: ");
Scanner in = new Scanner(System.in);
x = in.nextInt();
System.out.println("Enter second integer: ");
y = in.nextInt();
z = x + y;
System.out.println("Sum of entered integers is " + z);
}
}
import java.io.*;
public class AddNumbers
{
public static void main(String args[])throws Exception
{
int a, b, c;
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter first integer: ");
a = Integer.parseInt(br.readLine());
System.out.println("Enter second integer: ");
b = Integer.parseInt(br.readLine());
c = a + b;
System.out.println("Sum of entered integers is " + c);
}
}
import java.io.*;
public class AddNumbers{
public static void main(String[] args) throws IOException
{
BufferedReader is = new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Please enter any input: ");
String s = is.readLine();
System.out.format("you entered: %s",s);
}
}
import javax.swing.JOptionPane;
public class AddNumbers
{
public static void main(String args[])throws Exception
{
String userInput = JOptionPane.showInputDialog("Enter your name: ");
System.out.println(userInput);
}
}
import java.io.Console;
class AddNumbers {
public static void main(String[] args)
{
Console c = System.console();
String s = c.readLine("Enter a string: ");
System.out.println("the string you entered is: " + s);
}
}