JAVA LANGUAGE Select all answers that are correct How can on
JAVA LANGUAGE
Select all answers that are correct.
How can one check that two non-primitive type variables x and y are of exactly of the same type ?
a) x.class == y.class
b) x.getClass() == y.getClass()
c) x instanceof y.getClass()
d) x.getClass().equals(y.getClass())
Solution
Answer:
Below both statements will give the exactly of the same type.
b) x.getClass() == y.getClass()
d) x.getClass().equals(y.getClass())
