Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2007, 03:31 PM
Senior Member
 
Join Date: Nov 2007
Posts: 115
ravian is on a distinguished road
Using Deprecated Methods
I understand that using deprecated methods are the methods that won’t be supported in the higher versions of Java. So, if I use it in my current Java, is it perfectly OK? I mean is it a bad practice or what?
Example: methods of Date class.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-23-2007, 07:47 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,144
hardwired is on a distinguished road
deprecated methods
if I use it in my current Java, is it perfectly OK?
You will get compiler warnings and the app will run okay. Java tries to backward–compatible up until j2se 1.5. Generics was a big change.
I mean is it a bad practice or what
Inelegant. When you get a compiler warning look up the method in the javadocs. The Method Summary and Method Detail sections will say that the method has been deprecated and tell what method to use in its place. This is the general paractice. For example, older apps used to use the show method to show a JFrame. Compiling code that uses the show method gives a compiler warning:
Code:
C:\jexp>javac stf.java Note: stf.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. C:\jexp>javac -Xlint:deprecation stf.java stf.java:73: warning: [deprecation] show() in java.awt.Window has been deprecate d f.show(); ^ 1 warning C:\jexp>java STF C:\jexp>
You can run the app okay as–is if you like. If you want to get the details recompile as indicated. Looking in the JFrame class api for the show method you find it in the section "Methods inherited from class java.awt.Window". Follow the link to see that it has been replaced by setVisible as of j2se 1.5
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-23-2007, 08:34 PM
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
Generally that is not a good idea however. Deprecated means that they don't have be supported in later versions of java, therefore killing portability.

Also i have found that it is a better idea to use the methods that are provided to replace them. They are deprecated for a reason.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-23-2007, 08:58 PM
Senior Member
 
Join Date: Nov 2007
Posts: 115
ravian is on a distinguished road
Thanks a dozen.
So -- Say No to Deprecated Methods
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help with a deprecated program mikau New To Java 0 02-13-2008 10:34 AM
getYear deprecated method ravian New To Java 1 01-28-2008 11:35 AM
methods Zensai New To Java 10 12-03-2007 06:31 AM
Methods Java Tip Java Tips 0 12-01-2007 09:49 PM
method size is deprecated oregon New To Java 4 08-05-2007 06:59 PM


All times are GMT +3. The time now is 09:50 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org