Read a string from the command line
reads a string from the command line. Should be easy but it wasnt explained well so I wrote this.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
// hello <string>
import java.io.*;
public class hello
{
public static void main(String[] args)
{
//setup global vars (bad)
String userName = null;
//setup input buffer
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//do my stuff
System.out.print("\nWhats your name?\n\n");
//make sure to cath errors (they happen often with this ;( )
try
{
userName = br.readLine();
}
catch (IOException ioerror)
{
System.out.println("IO error trying to read your name!");
System.exit(1);
}
System.out.print("\n\n\nHello " + userName + "!!!\n\n\n");
}
}
Original Comments (3)
Recovered from Wayback Machine