Totel:36 Click: 1 2 3 4 5 6 7 8
The class object is very important of the all classes.which has an equals() method.That means every other Java class inherits an equals() method. In java.lang, the String and wrapper classes have overridden the equals() method to behave as we just discussed.
When two String objects have the same value. When we are using == this operators is called the equal() method.
When we want to determine if two objects are meaningfully equivalent, use the equals() method. this operator returns a boolean value true this means that that are equal .if returns false .that means its doent.here we have a code .that are following here :
String x1 = "abc";
String x2 = "ab";
x2 = x2 + "c";
We always compare the primitive values using this method.Primitive variables are stored in memory as some absolute number of bits, depending on the type of primitive being handled.
We can also say like this that we can't know from one Java implementation to the next how big a reference variable is it might be 64 bits, it might be 97 bits.but the key thing to remember is that wherever a Java program might run, all of the reference variables running on a single VM will be the same size (in bits) and format.
> java.lang.Boolean all wrappers
The Integer and Long wrapper classes let we convert numbers in base 10 to other bases. These conversion methods, toXxxString(), take an int or long, and return a String representation of the converted number, for example :
String s3 = Integer.toHexString(254); // convert 254 to hex
System.out.println("254 in hex = " + s3); // result is "254 in hex = fe"
String s4 = Long.toOctalString(254); // convert 254 to octal
System.out.println("254 in octal = "+ s4); // result is "254 in octal = 376"
1 2 3 4 5 6 7 8