Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java Programming - Getting the input from the keyboard
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Doshyo
Java Programming - Getting the input from the keyboard
1 Answer(s)      6 years and 10 months ago
Posted in : Java Beginners


I need a Java program to take a input from the keyword.


Advertisement
View Answers

February 27, 2008 at 4:32 PM


For getting the input from the keyboard you used this line of code it will not create the error because

BufferedReader object = new BufferedReader(new InputStreamReader(System.in));

System.in is a byte stream that has no character stream features. To use Standard Input as a character stream, wrap System.in within the InputStreamReader as an argument.

InputStreamReader inp = new InputStreamReader(system.in);



In your program you used this line of code DataInputStream object =new DataInputStream (new InputStream(System.in));.....

it will create the errors like this

Factorial.java:24: java.io.InputStream is abstract; cannot be instantiated
DataInputStream object =new DataInputStream (new InputStream(System.in));
^
Note: Factorial.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

Because InputStream class is the abstract class we can't create an instance of this class and DataInputStream is used for the following purpose .

DataInputStream:

This class is a type of FilterInputStream that allows you to read binary data of Java primitive data types in a portable way. In other words, the DataInputStream class is used to read binary Java primitive data types in a machine-independent way. An application uses a DataOutputStream to write data that can later be read by a DataInputStream.

Java Input Output Examples
Resources - http://www.roseindia.net/java/example/java/io/



Related Tutorials/Questions & Answers:
keyboard input
keyboard input  how do I use JOptionPane to accept keyboard input? I know how to import but not specific command on input line   import javax.swing.*; class JOPtionPaneExample { public static void main(String
how to use marathi keyboard in java programming?
how to use marathi keyboard in java programming?  how to use Marathi keyboard in java programming
Advertisements
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
java keyboard shortcuts - Struts
java keyboard shortcuts  hi, i hav an application already developed using struts framework.now i would like to add some keboard shortcuts to my application, so that the user need not to go for the usage of the mouse every time
How to read data dynamically from keyboard to array in flex
How to read data dynamically from keyboard to array in flex  How to read data dynamically from keyboard to array in flex
write a program to remove the element from hashset using keyboard.
write a program to remove the element from hashset using keyboard.  write a program to remove the element from hashset using keyboard
java user input - Java Beginners
java user input  how to input from keyboard? please give a example.  Hi Friend, There are lot of ways to input data from keyboard.You...:****** try{ System.out.print("Enter String:"); BufferedReader input = new
Input / Output in Easiest Method in Java
Input / Output in Easiest Method in Java  How to input from keyboard... with the easiest method in Java?   Hi Friend, Try the following code: import...)throws Exception{ Scanner input=new Scanner(System.in
Input From Console
Input From Console     ... and implements flushable interface. The Input from Console is used to access the character... in understanding a code Input from Console. For this we have a class 'Input From Console
Java Command Line Input
Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line System.out.println("Please Input A Number"); BufferedReader br
error in taking input from user.
error in taking input from user.  //i m having problem inputting the array from user.my program is import java.io.*; class bubble { public static void main(String args[]) { int a[]=new int[20]; int i=0; BufferedReader br=new
write a java pogram to add elements to linked list using keyboard and display it
write a java pogram to add elements to linked list using keyboard and display it  write a java pogram to add elements to linked list using keyboard and display
Java get User Input
Java get User Input       In this section, you will learn how to get the user input from... input. The br.readline() method reads the name from the command line. After
input - Java Beginners
to input the data from the command prompt. Try the following code to input name...input  i want to know how to take value from user in core java.help me soon.  Hi Friend, There are lot of ways to input data.You can use
how java programming differ from pascal and C - Java Beginners
how java programming differ from pascal and C  how Does the Java programming language differs from Procedural languages such as Pascal and C.when ýt... and Pascal are both arguably descendants of the ALGOL programming language series. ALGOL
different type input in java
type of input method. thank   Java Read through DataInputStream: import...); } }   Java read input through Scanner: import java.util.*; class...); } }   Java read input through BufferedReader import java.io.*; public class
java input problem - Java Beginners
java input problem  I am facing a Java input problem
how to transliterate the input from english to japanese
how to transliterate the input from english to japanese  Hi everyone , I am trying to make an application in java in which i want to get input from... possible in java :) please help me please :) Thanks In Advance
Java User Input
Java User Input  I am using Scanner class for user Input. Scanner s = new Scanner(System.in); String name = s.next(); but i am unable to store full name in name variable...how i can store full name plsss reply   use
java programming - Java Beginners
java programming  write and run a programme that accept a string from keyboard and convert it into a number.  Hi Friend, Please visit.../StringToInt.shtml IF you want to generate hashcode from input string then try
input output in java
input output in java  java program using filereader and filewriter   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args) throws
Java programming - Java Beginners
Java programming  hi sir, my question are as follows... hope u can solve my java programming problem.. Write a program to develop a class to hold... keyboard input.   Hi friend, For solving the problem visit
Swap two any numbers (from Keyboard)
Swap two any numbers (from Keyboard)   .... If  you are newbie in Java programming then our tutorial and example are helpful for understanding Java programming in the simplest way.  Here we
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  sir thanks a lot for ur reply for my last question, can u please send me the entire project code of virtual on screen keyboard.i did but im not sure as it was right
How to create file from input values in Jframe ?
How to create file from input values in Jframe ?  hi i m doing my project using java desktop application in netbeans.i designed a form to get... the inputs given by the user.i had a java program for it and accessed it by creating
JavaScript Array from Input
JavaScript Array from Input   ... you easy to understand an example of  Array from Input. The example create a HTML Page JavaScript array from input include a text name 'name', a text field
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
Count repetitions of every word from an input file
Count repetitions of every word from an input file  Hello..i got to know how can i count the repetitions of every word present in a specific input file?For suppose if i have a url log file which have time,url's,ip address etc
Ask make graph from i report and view to java Language Programming
Ask make graph from i report and view to java Language Programming  Dear sir, Please help me, i want to make a graph from mysql to i report and view to java. Please help me, give me example source code please. thank you
input
input  a java program that will exchange the last names of two students that were input by a user
Advertisements
 

 

 

DMCA.com