473,387 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

overrides a deprecated API.

raveendrabikkina
import java.io.*;

class InputTest
{
public static void main(String []args) throws IOException
{
byte [] bytes = new byte[20];
BufferedInputStream bis = new BufferedInputStream(System.in);
DataInputStream dis = new DataInputStream(bis);
String str = dis.readLine();

DataOutputStream dos = new DataOutputStream(System.out);
dos.writeUTF(str.toUpperCase());

dos.close();

System.out.println("End of program"); // this willnot be printed

}
}
This is the result when i try to complie this code help me out...!!!Java\jdk1.5.0\bin>javac InputTest.java


Note: InputTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Feb 22 '08 #1
12 20352
r035198x
13,262 8TB
1.) Please use code tags next time when posting code.
2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
3.) Why don't you use java.util.Scanner for getting input from the console?
Feb 22 '08 #2
1.) Please use code tags next time when posting code.
2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
3.) Why don't you use java.util.Scanner for getting input from the console?
thank you for your reply i'm just a beginer in java.i'm new to this community.i don't know the syntax for postings.
Feb 22 '08 #3
1.) Please use code tags next time when posting code.
2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
3.) Why don't you use java.util.Scanner for getting input from the console?
what does this(Recompile with -Xlint:deprecation for details.) mean how to recompile tat with -Xlint????
Feb 22 '08 #4
r035198x
13,262 8TB
what does this(Recompile with -Xlint:deprecation for details.) mean how to recompile tat with -Xlint????
Just do
Expand|Select|Wrap|Line Numbers
  1. javac -Xlint YourClassName.java
when compiling the class. You can then check the API to see what has now replaced that method.
Feb 22 '08 #5
Just do
Expand|Select|Wrap|Line Numbers
  1. javac -Xlint YourClassName.java
when compiling the class. You can then check the API to see what has now replaced that method.
javac: invalid flag: -Xlint
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options



this is wat the message i'm getting.what to do??
Feb 22 '08 #6
ok if i use javac -deprecation myclassname.java this is what i'm getting now what is the solution for this?

InputTest.java:10: warning: readLine() in java.io.DataInputStream has been depre
cated
String str = dis.readLine();
^
1 warning
Feb 22 '08 #7
r035198x
13,262 8TB
javac: invalid flag: -Xlint
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options



this is wat the message i'm getting.what to do??
What had you typed?
Feb 22 '08 #8
What had you typed?
Expand|Select|Wrap|Line Numbers
  1. javac -Xlint InputTest.java
Feb 22 '08 #9
r035198x
13,262 8TB
ok if i use javac -deprecation myclassname.java this is what i'm getting now what is the solution for this?

InputTest.java:10: warning: readLine() in java.io.DataInputStream has been depre
cated
String str = dis.readLine();
^
1 warning
Now read all my responses again.
Feb 22 '08 #10
You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.

--->compiler said nothing
Why don't you use java.util.Scanner for getting input from the console?

how to use java.util.Scanner ???
Feb 22 '08 #11
ok got the solution but i think this is because of the jdk version change...

thnq buddy
Feb 22 '08 #12
r035198x
13,262 8TB
Y...>compiler said nothing
..
The compiler told you the exact line number where the warning is and and even went as far as to give the exact method name that you used which is deprecated.


how to use java.util.Scanner ???
java.util.Scanner

P.S A warning is not the same as an error. The program compiles, creates the .class file and runs even if the compilation produced a warning.
P.PS The posting guidelines can be found here.
P.P.PS Welcome to TSDN.
Feb 22 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ECVerify.com | last post by:
I posted this earlier but never got a response...so I am trying again **************************** Hey everyone, I have a simple (I hope question) To get the events in C# I can go to the...
4
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional)...
45
by: Matt Parkins | last post by:
Hi, (I realise this probably isn't precisely the right group for this - could someone direct me to the appropriate group to post this question? - thanks !) I'm using Visual C++ 2005 Express...
3
by: Ben Rush | last post by:
When I compile my solution I get the following output - NET 2003\Vc7\atlmfc\include\atlwin.h(2027) : warning C4995: 'wsprintf': name was marked as #pragma deprecated C:\Program Files\Microsoft...
9
by: Surrealist | last post by:
I need something likes as when I create an event procedure. I can use top-left and top-right dropdown list of code editor to select object and its exposed events respectively. Then, the IDE,...
10
by: Atif | last post by:
Hi I am here to solve a small confusion i have in "Overloads Overrides". "Overloading" says that the method's name should be same while no. of parameters and/or their datatypes should be changed...
2
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to...
12
by: André | last post by:
Hi, i'm learning working with classes. In class "classbase1", i defined an overridable function. In the class "subclass1", i defined the same function with 'Overrides'. In class "classbase2", i...
1
by: =?Utf-8?B?QnJldHRWUA==?= | last post by:
I have a child-class that inherits from a base class that implements an Interface. The child class overrides a SUB from the base class that implements a sub from the interface. (The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.