Home  >  Forum  >  Core Java
Post New Query

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;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class InputTest {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
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







©2019 concretepage.com | Privacy Policy | Contact Us