I am working on an assignment and don't understand downcasting. For example, class Reference.java and I'm in a method that passes an object in. If that object is of type (not sure if that is the right word) then create a new Reference object. This is what I have right now but it doesn't work.
public method(Object obj){
if( obj instanceof Reference){
Object obj = new Reference();
}
}
Now the constructor for Reference.java needs two parameters and I also don't understand how in the world this would work when downcasting.