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:
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