answersLogoWhite

0

Yes, the if the two string objects point to the same memory location. But "==" is not the best way to compare two string objects. Two strings can be compared using obj1.equals(obj2). This compares for the textual equal-ness of the two string objects.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

What does equals equals mean in java?

operator to compare two objects. The simple "=" sign is used for assignment - assigning a value to a variable. Here are examples of the two: x = 15; // Assign the value 15 to the variable if (x == 10) ... // Compare variable "x" with some value


How do you find out not equals string in java?

Remember that strings are objects. You can use the String.equals method to determine equality, and use the ! (not) operator to test for inequality. public static boolean notEquals(String str1, String str2) { return !str1.equals(str2); }


Is x plus equals y is post increment or pre increment?

The '+=' operator behaves like a pre increment operator.


What is the use of 'compareTo' in java?

To compare the contents of two objects. The equality, "=", will simply tell you whether two objects are in the same memory location; it doesn't tell you whether their contents are actually the same. To compare the contents, there is an equals() method which tells you whether the contents are actually equal; there is also a compareTo() which can also tell you which of two objects is "greater". Since objects can be quite complex, the programmer may have to overwrite the (often useless) default behavior of these methods.


What is the difference between you equals 10 and you equals equals 10 in c language?

The = operator is the assignment operator. The == operator is the equality or equals operator. The = operator is the assignment operator. We use it to assign a value (the right hand operand) to an object (the left hand operand). The value must be of the same type as the object unless the value can implicitly convert to the object's type. If not, we must explicitly cast the value to the appropriate type. The operator evaluates to the value of the object after assignment, thus creating a temporary value that can be used in other expressions. Examples: int you; you = 10; // assign the value 10 to the object named 'you' int me, you; me = 10; you = 10; Note that the second example can also be written: int me, you; me = you = 10; This is because the expression 'you = 10' evaluates to the temporary value 10 (the value of 'you' after assignment) which we then assign to 'me'. Operators are evaluated according to operator precedence, and assignment 'chains' like this are always evaluated from right to left. The == operator is the equality or equals operator. We use it to determine if two object's have the same value. If so, the expression evaluates true, otherwise false. Operators that evaluate true or false are known as Boolean operators (functions that return true or false are known as predicates). Typically we use the == operator in conditional expressions: if (a == b) { // code to execute when the value of a is equal to the value of b } else { // code to execute when the value of a is not equal to the value of b } while (a == b) { // This code will loop repeatedly so long as a is equal to b at the beginning of each iteration } The == operator is one of six Boolean operators that can be used to compare object values: == : equal != : not equal < : less than <= : less than or equal > : greater than >= : greater than or equal

Related Questions

What does equals equals mean in java?

operator to compare two objects. The simple "=" sign is used for assignment - assigning a value to a variable. Here are examples of the two: x = 15; // Assign the value 15 to the variable if (x == 10) ... // Compare variable "x" with some value


How do you find out not equals string in java?

Remember that strings are objects. You can use the String.equals method to determine equality, and use the ! (not) operator to test for inequality. public static boolean notEquals(String str1, String str2) { return !str1.equals(str2); }


In excel if the formula equals A1 plus B1 what is the operator?

For =A1+B1, the operator is the plus sign (+).


How do you use equals equals equals operator in javascript?

'1' will return false because one variable is an integer and the other is a string.


Is x plus equals y is post increment or pre increment?

The '+=' operator behaves like a pre increment operator.


Difference between equals equals and equal in java?

"==" in java is the binary operator which compares two values and gives a boolean result While "=" in java is a assignment operator which assigns a value to a variable.


What is the use of 'compareTo' in java?

To compare the contents of two objects. The equality, "=", will simply tell you whether two objects are in the same memory location; it doesn't tell you whether their contents are actually the same. To compare the contents, there is an equals() method which tells you whether the contents are actually equal; there is also a compareTo() which can also tell you which of two objects is "greater". Since objects can be quite complex, the programmer may have to overwrite the (often useless) default behavior of these methods.


Use Guassian quadrature with n equals 1 and n equals 2 and compare to exact value I equals compare to exact value?

Use Guassian quadrature with n=1 and n=2 and compare to exact value I=


What is difference between equals and equals equals operators?

The equals operator is used for assigning a value to a variable. ex String name = "efu"; the equals equals operator is used for comparaing if the given value is equal to another value which is assigned for a variable. ex int i = 0; int j = 5; if( i == 0){ System.out.println(j+"can't be divided by"+i); }else{ System.out.println("answer is " +j/i); }


Is a syntax B1-B2B3 is an example of formula in excel?

No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3No. There is no equals sign at the start and the cell reference B2B3 is not valid or has an operator missing. A possible formula variation on it could be:=B1-B2+B3


If I compare bread to crust what can I compare beacon with?

Bread equals crust (outer layer of a loaf).Bacon equals bacon rind (outer layer of the skin of a pig).


What is the difference between you equals 10 and you equals equals 10 in c language?

The = operator is the assignment operator. The == operator is the equality or equals operator. The = operator is the assignment operator. We use it to assign a value (the right hand operand) to an object (the left hand operand). The value must be of the same type as the object unless the value can implicitly convert to the object's type. If not, we must explicitly cast the value to the appropriate type. The operator evaluates to the value of the object after assignment, thus creating a temporary value that can be used in other expressions. Examples: int you; you = 10; // assign the value 10 to the object named 'you' int me, you; me = 10; you = 10; Note that the second example can also be written: int me, you; me = you = 10; This is because the expression 'you = 10' evaluates to the temporary value 10 (the value of 'you' after assignment) which we then assign to 'me'. Operators are evaluated according to operator precedence, and assignment 'chains' like this are always evaluated from right to left. The == operator is the equality or equals operator. We use it to determine if two object's have the same value. If so, the expression evaluates true, otherwise false. Operators that evaluate true or false are known as Boolean operators (functions that return true or false are known as predicates). Typically we use the == operator in conditional expressions: if (a == b) { // code to execute when the value of a is equal to the value of b } else { // code to execute when the value of a is not equal to the value of b } while (a == b) { // This code will loop repeatedly so long as a is equal to b at the beginning of each iteration } The == operator is one of six Boolean operators that can be used to compare object values: == : equal != : not equal < : less than <= : less than or equal > : greater than >= : greater than or equal