R4R
Right Place For Right Person TM

How to compare two strings ?

previous previous previous
Question:
How to compare two strings ?

Question:How to compare two strings ?


Answer
There are two ways to compare the two strings in java: * using the == operator, * using the equals() method. For Example: String s1=new String("Hello!"); String s2=new String("Hello!"); if(s1==s2) System.out.println("Equal using == operator."); elseif (s1.equals(s2)) System.out.println("Equal using equals method."); else System.out.println("Not Equal.");

By:Jalees
Date:

How to compare two strings ?

Post Your Answers


User Name:
Answers:

Related Links

  1. What is the purpose of run-time class and system class?
  2. What is the method used to clear the buffer ?
  3. What is mean by Stream Tokenizer ?
  4. What is serialization and de-serialisation ?
  5. What is mean by Applet ?
  6. How to find the host from which the Applet has originated ?
  7. What is the life cycle of an Applet ?
  8. How do you load an HTML page from an Applet ?
  9. What is mean by getCodeBase and getDocumentBase method ?
  10. What is the use of parameter tag ?
  11. What is the difference between getAppletInfo and getParameterInfo ?
  12. How to communicate between applet and an applet ?
  13. What is mean by event handling ?
  14. What are all the listeners in java and explain ?
  15. What is mean by an adapter class ?
  16. What are the types of mouse event listeners ?
  17. What are the types of methods in mouse listeners ?
  18. What is the difference between panel and frame ?
  19. What is the default layout of the panel and frame ?
  20. What is the difference between list and choice ?
  21. What are the different types of Layouts ?
  22. What is mean by CardLayout ?
  23. What is the difference between GridLayout and GridBagLayout?
  24. Which class has no duplicate elements ?
  25. What is mean by Swing ?
  26. What is the difference between an applet and a Japplet?
  27. What are all the components used in Swing ?
  28. What is mean by tab pans ?
  29. What is the use of JTree ?
  30. What is the use of JTable ?
  31. What is mean by JFC ?
  32. What is JAR file ?
  33. What is mean by manifest files ?
  34. What is two properties in Beans ?
  35. What is the use of beaninfo ?
  36. What are the interfaces you used in Beans ?
  37. What are the classes you used in Beans ?
  38. What is the difference between C++ & Java ?
  39. What is the difference between Process and Threads ?
  40. How will you initialize an Applet ?
  41. What is the order of method invocation in an Applet ?
  42. When is update method called ?
  43. What is JNI ?
  44. What is the base class for all swing components ?
  45. Is there any tag in HTML to upload and download files ?
  46. What is the Layout for ToolBar ?
  47. How will you add panel to a Frame ?
  48. What is the corresponding Layout for Card in Swing ?
  49. What is light weight component ?
  50. What is difference in between Java Class and Bean ?

Question:How to compare two strings ?

Back Home Next

New Updates

Topics

Topics

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R