By: aathishankaran Printer Friendly Format
Input and output in java
In the examples the keyword display was used for displaying the results of programs. The keyword display can be used for displaying constants as well as variables.
- display Salary;
This displays the value stored in the numeric variable Salary on the screen
- display “Manila”;
This displays the string “Manila” on the screen
The keywords accept is used to obtain values from the user through the input device (Keyboard).
This causes the program to wait for the user to type numeric value. The numeric value entered by the user will be stored in the variable Salary.
The following program accepts a name from the user and displays the same.
display “Enter Name:”;
If the name is typed as “Robinson”, it will display:
On the screen
Most Viewed Articles (in Java )
Latest Articles (in Java)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews