How to input data from user in java

Asked on October 05, 2013
give me a program demo of java language to input 2 no. from the user.

Replied on October 06, 2013
Hi Atul, find  a simple java program to take to input from user.

package com.test;


public class InputTest {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(;
BufferedReader br = new BufferedReader(isr);
System.out.println("Enter first number..");
int i1 = Integer.parseInt(br.readLine());
System.out.println("Enter Second number..");
   int i2 = Integer.parseInt(br.readLine());
System.out.println("you enterd "+i1+" and  "+i2);

Hope it work for you.

Replied on October 10, 2013
Yes its working. Thank You!

Write Answer

©2024 | Privacy Policy | Contact Us