![]() ![]() The reader will read from the standard input stream ( System.in) that is, from the keyboard. ![]() Statement #2 creates a reader called istream. In WelcomeMsg.java, statement #1 imports the packages required for input/output operations. InputStreamReader istream = new InputStreamReader(System.in) #2īufferedReader bufRead = new BufferedReader(istream) #3 For example, if the user enters the name "Kelly," the message, "Welcome Kelly!" appears on the screen. After entering the name, when the user presses Enter, a welcome message appears, including the name the user typed. ![]() The code shown in Listing 1 is a simple Java program called WelcomeMsg.java that asks the user to enter a name. Learn More Buy Example: A Simple Java Program ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |