Advertisements
Advertisements
Question
State the difference between == operator and equals () method.
Advertisements
Solution
| S. No. | == operator | equals () |
| 1. | It is a relational operator. | It is a method of string class. |
| 2. | It checks for equality of primitive type of values. | It checks for equality of two string types of values. |
APPEARS IN
RELATED QUESTIONS
Write a difference between unary and binary operator.
What are the various types of errors in Java?
What is meant by a package?
Name the operators listed below are
(i) <
(ii) + +
(iii) &&
(iv) ? :
Write a Java expression for the following :
ax5 + bx3 + c
Rewrite the following using ternary operator:
if (x%2 == o)
System.out.print(“EVEN”);
else
System.out.print(“ODD”);
Write a Java expression for the following :
`sqrt(3"x"+"x"^2)/"a+b"`
Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string.
Sample input: we are in a cyber world
Sample output: We Are In Cyber World
Write the Java expression for (a + b)x.
Evaluate the expression when the value of x = 4;
x* = - - x + x + + + x
