This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes AWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "AWT" Watch "AWT" New topic
Author

AWT

DB Ekanayake
Greenhorn

Joined: Apr 07, 2008
Posts: 8
Hi

I get the following form a Java Tut and compile on My Win Xp Mechine.
Compiler gives following massages:
Note: HowToWindow.java uses or overrides a deprecaed API.
Note: Recompile with -Xlint eprecation for details.

But it runs correctly and gives the particular out put

Please Help Me

Thanks

import java.awt.Frame;
import java.awt.Label;
public class HowToWindow extends Frame{
public static void main(String arg[]){
new HowToWindow();
}
HowToWindow(){
Label label;
label=new Label(" How To");
add(label);
pack();
show();
}
}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
It's a warning, not an error - that's why you have no problems running the code.

Sometimes certain methods or classes of the Java API are made "deprecated". That means they shouldn't be used any more, and that there is a better alternative for achieving the same goal.

If you compile with the "-deprecation" flag the compiler will tell you in detail which methods are deprecated. In this case it's the "show()" method. Generally, the javadocs of the deprecated methods/classes will tell you what you should use instead.


Ping & DNS - updated with new look and Ping home screen widget
DB Ekanayake
Greenhorn

Joined: Apr 07, 2008
Posts: 8
Hi

Thanks Ulf

I Learned much about the Deprecation from JavaDocs.
show() is replaced by setVisible(boolean).
Now my codes work pretty.

Thanks

DB
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT
 
Similar Threads
Events
noob needs help with path
deprecated API [ wish to learn complete on it ]
Not sure if this the place??
Exam tip & a question