let us create a program to demonstrate input and output in java.The program will accept the Name and Age of user as input and display it back on the terminal window as output.

import java.io.*;
public class UsingStream
    public static void main(String ags[])throws IOException
	   InputStreamReader objectISR=new InputStreamReader(System.in);
	   BufferedReader objectBR=new BufferedReader(objectISR);
	   System.out.printIn("Please enter your name");
	   String name=objectBR.readLine();
	   System.out.printIn("Please enter your age");
	   String age=objectBR.readLine();
	   System.out.printIn("Hi"+name+"you are"+age+"yrars old");

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Show Buttons
Hide Buttons