java - What is the difference between instanceof and Class.isAssignableFrom(...)? -


Which of the following is better?

When instanceof , you will be able to compile B Need to know the class When using isAssignableFrom () , it can be dynamic and can change during runtime.


Comments