If you have classes B and C, both of these inherited A, and when you created an object of B or C, how do you know what class this instantiated?
java inheritance
if (obj instanceof C) {
//your code
}
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.