5 years ago in Java Strings

What is the output of this program?

class string_class {

public static void main(String args[])

{

String obj = "hello";

String obj1 = "world";

String obj2 = "hello";

System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));

}

}

[A] false false
[B] true true
[C] true false
[D] false true
Loading...
Next Question

Overall Stats

Attempted 291
Correct 128
Incorrect 66
Viewed 97

Answers

Guest
Guest
bruh
bruh - 1 month ago

bruh from Guwahati, India is saying false true is correct answer

Assaad Amine
Assaad Amine - 1 month ago

Assaad Amine from Casablanca, Morocco is saying false true is correct answer

Zo Go
Zo Go - 1 month ago

Zo Go from Casablanca, Morocco is saying false true is correct answer

Vaibhav Bisht
Vaibhav Bisht - 1 month ago

Vaibhav Bisht from Dehradun, India is saying true true is correct answer

Awa Kone
Awa Kone - 1 month ago

Awa Kone from Berrechid, Morocco is saying true true is correct answer

Related Questions

String is an________

  • [A] class
  • [B] Variable
  • [C] Array
  • [D] Data type

What will happen if you try to compile and run the following code ?
public class MyClass {

    public static void main(String arguments[]) { 

    }

    public void amethod(String[] arguments) { 

    }

}

  • [A] error Can't make static reference to void method.
  • [B] error method main not correct
  • [C] error array must include parameter
  • [D] amethod must be declared with String