please give me an idea to develop a program for this question?

Ads
 

please give me an idea to develop a program for this question?

How to enter a text or number from keyboard without using InputStreamReader method in java?

View Answers

May 11, 2012 at 3:48 PM

Java Input values using Scanner Class

You can use Scanner class to input text or integer or double value. This class is having several different method to input string value, integer value, double value, float value etc.

import java.util.*;

class InputUsingScannerClass
{
    public static void main(String[]args){
    Scanner input=new Scanner(System.in);
    System.out.println("Enter string:");
    String str=input.nextLine();

    System.out.println("Enter integer:");
    int num1=input.nextInt();

    System.out.println("Enter double value:");
    double num2=input.nextDouble();

    System.out.println("Enter long value:");
    long num3=input.nextLong();
    System.out.println();
    System.out.println("Input Values: ");


    System.out.println(str);
    System.out.println(num1);
    System.out.println(num2);
    System.out.println(num3);

}

}

Ads









Related Tutorials/Questions & Answers:
please give me an idea to develop a program for this question?
please give me a java program for the following question
Advertisements
Please give me the answer.
Please give me coding for this..
why and where we use setter and getter methods in java, please give me one example program.....
Please explain me the flow of this program..
how to send email please give me details with code in jsp,servlet
please explain me the flow of this program
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question
give idea
please give me an example about shopping cart using spring and hibernate
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question
Hi Every One , please give me some idia to opning audio File . please Help ..
hi.. please give me a java coding for the following question
hi.. please give me a java coding for the following question
please help me in coding this given program
please help me in coding this given program
please help me to write a code for this program
please help me to write a code for this program
please tell me the flow of execution of this program
please eslain me the flow of execution of this program
A few questions related to developing a blog....can anyone please help me out??
Getting Exception on UseDefinedException sample program - Please help me how to resolve
how can i write this program ?please suggest me
please please i wanna insertion sort program find calendar to array value (1000,5000,10000), please help me
plz give me answer
plz give me answer
plz give me answer

Ads