0
How to ask user to input some number and print it?
4 odpowiedzi
+ 2
BufferedReader br = new BufferedReader(InputStreamReader(System.in));
System.out.println("Enter any no: ");
int a= Integer.parseInt(br.readLine());
System.out.println(a);
+ 1
import java.util.*;
public class Test
{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int num=0;
System.out.println("Enter a number");
try{
num = in.nextInt();
}catch(Exception ex){
System.out.println("Not allowed");
}
System.out.println("num: "+num);
}
}
0
int a =Integer.parseint(joptionpane.showinputdialog("input no."));
system.out.print(a);
0
tnx