Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Which of the following lines will print false?

Which of the following lines will print false?
  1. public class StringDemo
  2. {
  3.    static String str1 = "Hello world";
  4.    public static void main(String args[])
  5.    {
  6.        String str2 = "Hello world";
  7.        String str3 = new String(str1);
  8.        System.out.println(str1 == str2);
  9.        System.out.println(str1.equals(str2));
  10.        System.out.println(str3 == str1);
  11.        System.out.println(str3.equals(str1));
  12.  
  13.    }
  14. }
a. line 10
b. line 9, 11
c. line 8, 10
d. line 8
No votes yet
Share this

Post new comment

4 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.