Import java. Io. bufferedreader;
Import java. Io. ioexception;
Import java. Io. inputstreamreader;
Import java. util. collections;
Public class mainclass
{
Public static void Method1 ()
{
// Use logging
Required bytes = new bytes (system. In );
System. Out. Print ("Please input a number :");
Int num = bytes. nextint (); // obtain the integer
System. Out. println ("the number you input is:" + num );
System. Out. println ("----------------------------");
System. Out. Print ("Please input some character :");
String STR = response. Next (); // obtain the string value
System. Out. println ("the string you input is:" + Str );
}
Public static void method2 ()
{
// Use bufferedreader
Try
{
Bufferedreader reader = new bufferedreader (New inputstreamreader (system. In ));
System. Out. Print ("Please input a number :");
String STR = reader. Readline (); // obtain the string
System. Out. println ("the number you input is:" + Str );
} Catch (ioexception E)
{
E. printstacktrace ();
}
}
}