whats the difference between == and .equal ?

Answer Posted / nagaraju

== it is relational operator to copares the values
.equals() is a method to compares the two strings whether
they are equal or not.

if(a==b)
System.out.println("both are equal");


object.equals(string1,string2)
System.out.println("strings are same");

Is This Answer Correct ?    24 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name four container classes.

559


What is difference between fileinputstream and filereader in java?

561


How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

543


Explain the difference between protected and default access.

518


what is recursion in java

600






What is the public method modifier?

546


What is meant by attribute?

595


Is a case study a method or methodology?

465


Define an abstract class with reference to java.

580


What are the advantages of assembly language?

503


Why do we declare a class static?

548


What is the default value of local and global variables?

567


What is annotation in java?

578


Can each java object keep track of all the threads that want to exclusively access it?

539


Explain the difference between runnable and callable interface in java?

588