Home  >  Forum  >  Core Java
Post New Query

How to input data from user in java


joined on
March 15,2013
Asked on October 05,2013
give me a program demo of java language to input 2 no. from the user.
joined on
May 11,2013
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.
joined on
March 15,2013
Replied on October 10,2013

Yes its working. Thank You!

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us