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

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);

}

}









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..
Please give me the code for the below problem - Java Interview Questions
why and where we use setter and getter methods in java, please give me one example program.....
please help me to give code - Java Beginners
please help me to give code - Java Beginners
please help me to give code - Java Beginners
please help me to give code - Java Beginners
please help me to give code - Java Beginners
Please explain me the flow of this program..
give idea
hi.. please give me a java coding for the following question
how to send email please give me details with code in jsp,servlet
please explain me the flow of this program
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.. 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 ..
hello sir, please give me answer - Java Beginners
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 help me for this program - Java Beginners
please tell me the flow of execution of this program
please help me in a java program !! - Java Beginners
please eslain me the flow of execution of this program
Pleae help me to give logic and code for this program - Java Beginners
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx
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
please give me solution how to display next page after 20 records ? - JSP-Servlet
A few questions related to developing a blog....can anyone please help me out??
plz give me answer
plz give me answer
plz give me answer
plz give me answer
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
GIVE ME A ANSWER
Please develop code - Development process
Plz give me code for this question
give me a grid example in php

Ads