1. Which two statements are true about wrapper or String classes? If x and y refer to instances of different wrapper classes, then the fragment x.equals(y) will cause a compiler failure. If x and y refer to instances of different wrapper classes, then x == y can sometimes be true. If x and y are String references and if x.equals(y) is true, then x == y is true. If x, y, and z refer to instances of wrapper classes and x.equals(y) is true, and y.equals(z) is true, then z.equals(x) will always be true. If x and y are String references and x == y is true, then y.equals(x) will be true.





Ask Your Doubts Here

Type in
(Press Ctrl+g to toggle between English and the chosen language)

Comments

  • By: guest on 02 Jun 2017 01.26 am
    Statement (4) describes an example of the equals() method behaving transitively. By the way, x, y,and z will all be the same type of wrapper. Statement (5) is true because x and y are referring to the same String object. Statement (1) is incorrect—the fragment will compile. Statement (2) is incorrect because x == y means that the two reference variables are referring to the same object. Statement (3) will only be true if x and y refer to the same String. It is possible for x and y to refer to two different String objects with the same value.
Show Similar Question And Answers
QA->Two statements are given followed by two conclusions I and II. You have to consider the two statements to be true even if they seem to be at variance from commonly known facts. You have to decide which one of the given conclusions is definitely drawn from the given statements. Statement : All virtuous persons are happy. No unhappy person is virtuous. Conclusions : I. Happiness is related to virtue II. Unhappy person is not virtuous.....
QA->.....is a device by virtue of which two persons at two different places can communicate. It consists of two main parts (i) a microphone and (ii) a receiver.?....
QA->Dog bite can cause rabies. Which other animal can also cause rabies?....
QA->Dog bite can cause rabies. Which other animals can also cause rabies?....
QA->P can do a work in the same time in which Q and R together can do it. If P and Q work together, the work can be completed in 10 days. R alone needs 50 days to complete the same work. then Q alone can do it in....
MCQ->Which two statements are true about wrapper or String classes? If x and y refer to instances of different wrapper classes, then the fragment x.equals(y) will cause a compiler failure. If x and y refer to instances of different wrapper classes, then x == y can sometimes be true. If x and y are String references and if x.equals(y) is true, then x == y is true. If x, y, and z refer to instances of wrapper classes and x.equals(y) is true, and y.equals(z) is true, then z.equals(x) will always be true. If x and y are String references and x == y is true, then y.equals(x) will be true.....
MCQ->Consider the following statements pertaining to a pile group and a single pile at failure : 1. In loose and medium dense sands, the failure load per pile in a group will generally be greater than the failure load for a single pile. 2. In cohesive soils, the failure load per pile in a group will be greater than failure load for a single pile. 3. For piles driven in dense sands, the failure load per pile in a group is greater than the failure load for a single pile. 4. When the pile spacing is greater than 10 times the pile diameter, the failure loads per pile in a group and forly same in both sands and clays. Of these statements :....
MCQ->Which two statements are true about comparing two instances of the same class, given that the equals() and hashCode() methods have been properly overridden? If the equals() method returns true, the hashCode() comparison == must return true. If the equals() method returns false, the hashCode() comparison != must return true. If the hashCode() comparison == returns true, the equals() method must return true. If the hashCode() comparison == returns true, the equals() method might return true.....
MCQ->Which of the following statements are correct? String is a value type. String literals can contain any character literal including escape sequences. The equality operators are defined to compare the values of string objects as well as references. Attempting to access a character that is outside the bounds of the string results in an IndexOutOfRangeException. The contents of a string object can be changed after the object is created.....
MCQ->What two statements are true about properly overridden hashCode() and equals() methods? hashCode() doesn't have to be overridden if equals() is. equals() doesn't have to be overridden if hashCode() is. hashCode() can always return the same value, regardless of the object that invoked it. equals() can be true even if it's comparing different objects.....
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution