I got a warning message on Object Casting while compiling my code. I have no idea how to fix it with my current knowledge....
Let's say I have a Generic Object MyGenericObj<T>
it is extends from a non-Generic Object MyObj
Here is a sample code:
MyObj obj1 = new MyGenericObj<Integer>();
if (obj1 instanceof MyGenericObj) {
//I was trying to check if it's instance of MyGenericObj<Integer>
//but my IDE saying this is wrong syntax....
MyGenericObj<Integer> obj2 = (MyGenericObj<Integer>) obj1;
//This line of code will cause a warning message when compiling
}
Could you please let me know what's the proper way of doing this?
Any help is appreciated.