I have read similar questions on the stackoverflow,but they answer what to do about it (compile it with -Xlint:deprecation
) and not why the error occurs in the first place.I want to know why the error popped in the first place.
The Box Class
public class box{
int height;
int length;
int breadth;
public int volume(){
return height*length*breadth;
}
box(int h,int l,int b){
height = h;
length = l;
breadth = b;
}
protected void finalize(){
System.out.println("Im dying!!");
}}
The Test Class
public class test{
public static void main(String[] args){
box a = new box(12,12,12);
System.out.println("The volume is :"+ a.volume());
a = null;
}}
The Error:
Note: ./box.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.