Java: Input strings with keyboard class

前端 未结 5 835
北海茫月
北海茫月 2020-12-20 10:34

I\'m trying to input information in Java console application but I can\'t seem to run it.

This is how my Java file looks like:


public class Ovn         


        
5条回答
  •  無奈伤痛
    2020-12-20 11:04

    try this

    try{
    
    BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Enter your Number :");
            String  number=buf.readLine();
            System.out.println("your Number is :"+number);
    
    
     }catch(IOException ex){} 
    

提交回复
热议问题