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())

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site