Hi All!

Thank you very much for the help / time you spend to resolve my
problem.  As I said I'm a new person in Java programming, I still
could not be benefitted with your suggestions.  My whole code was as
follows (before implementing your suggestions: :

// ICanReadApp.java

import java.lang.System;
import java.io.DataInputStream;
import java.io.IOException;
class ICanReadApp {
 public static void main (String args[]) throws IOException

{
  System.out.print("Enter your name: ");
  System.out.flush();
  String name;
  DataInputStream keyboardInput = new DataInputStream

(System.in);
  name=keyboardInput.readLine();
  System.out.println("Your name is: "+name);
 }
}

After incorporating your suggestions (I changed class name also
appropriately) the code is :

// ICanReadApp.java

import java.lang.System;
import java.io.DataInputStream;
import java.io.IOException;
class ICanReadApp1 {
 public static void main (String args[]) throws IOException {
  System.out.print("Enter your name: ");
  System.out.flush();
  String name;
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
     br.readLine();
  System.out.println("Your name is: "+name);
 }
}

But still I'm getting following four errors, I'm really confused as to
where is the problem :

"C:\jdk1.6\bin>javac ICanReadApp1.java
ICanReadApp1.java:11: cannot find symbol
symbol  : class BufferedReader
location: class ICanReadApp1
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
   ^
ICanReadApp1.java:11: cannot find symbol
symbol  : class BufferedReader
location: class ICanReadApp1
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
                           ^
ICanReadApp1.java:11: cannot find symbol
symbol  : class InputStreamReader
location: class ICanReadApp1
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
                                              ^
ICanReadApp1.java:11: cannot find symbol
symbol  : variable in
location: class ICanReadApp1
   BufferedReader br = new BufferedReader(new InputStreamReader(in));
                                                                ^
4 errors"

Kindly, suggest me the correct code.  I'm having JDK1.6 command line
development kit.

Thanks for your help in advance.
Vasu

On Sep 15, 12:31 am, ajones <[EMAIL PROTECTED]> wrote:
> Citation from jdk doc from DataInputStream:
>
> readLine()           Deprecated. 
>
> This method does not properly convert bytes to characters. As of
> JDK 1.1, the preferred way to read lines of text is via the
> BufferedReader.readLine() method. Programs that use the
> DataInputStream class to read lines can be converted to use the
> BufferedReader class by replacing code of the form:
>      DataInputStream d = new DataInputStream(in);
>
> with:
>      BufferedReader d
>           = new BufferedReader(new InputStreamReader(in));
>
> On Sep 14, 12:43 pm, Vasu <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi !
>
> > I'm a newbie in Java programming and created a code having readLine()
> > method.  While compiling the code I got following message :
>
> > ICanReadApp.java:12: warning: [deprecation] readLine() in
> > java.io.DataInputStrea
> > m has been deprecated
> >   name=keyboardInput.readLine();
>
> > Can any body help me in finding the method that we can read the inputs
> > from keyboard.
>
> > Thanks in advance for your help!
> > Vasu- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to