Home > front end >  Buffered function to get line command parameters
Buffered function to get line command parameters

Time:12-16

I’m trying to run this code:

public static void main (String [] args )
{ 
   BufferedReader reader = 
              new BufferReader (); 
   
   String name = reader.readLine(); 

   System.out.println(“Hello ”name);
}

But I’m getting an error.

CodePudding user response:

Please try to add the complete code for Buffered function, as this:

public static void main(String[] args) throws IOException 
{
    BufferedReader reader = 
               new BufferedReader(new InputStreamReader(System.in));
    String name = reader.readLine();

    System.out.println("Hello " name);        
}
  •  Tags:  
  • java
  • Related