Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
operator ==
:
Content language: English
Русский
What will be the result of the following code execution? public class StartClass { public static void main(String[] args) { Double d1 = 1d; Double d2 = 1d; System.out.println(d1 == d2); } }
operator ==
What is the following code execution result? Integer i1 = 10; Integer i2 = 10; Double d1 = 10d; Double d2 = 10d; System.out.println(i1 == i2); System.out.println(d1 == d2);
operator ==
What happens after the following code is compiled/executed? 1.import static java.lang.System.*; 2.public class A { 3. public static void main(String[] args){ 4. B b1 = new B("one","two"); 5. B b2 = new B("one", "two"); 6. B b3 = b1; 7. out.println(b1 == b2); 8. out.println(b1 == b3); 9. out.println(b2 == b3); 10. out.println(b1.equals(b2)); 11. out.println(b1.equals(b3)); 12. out.println(b3.equals(b2)); 13. } 14.} class B { public B(String prop1, String prop2){ this.prop1 = prop1; this.prop2 = prop2; } String prop1 = null; String prop2 = null; }
operator ==
What will be printed after the following code is executed? public class Main { public static void main(String[] args) { String strA = "text"; String strB = "text"; strA += "1"; strB += "1"; System.out.println(strA != strB); strA = "text1"; strB = "text1"; System.out.println(strA != strB); } }
operator ==
What will the following code's execution print out? public class Quizful { public static void main(String[] args) { Integer one = 1000; Integer two = 2000; System.out.print((one * 2 == two) ? "yes " : "no "); System.out.print((two / 2 == one) ? "yes " : "no "); } }
operator ==
What will be displayed? Integer a = 128; Integer b = 128; Integer c = -128; Integer d = -128; System.out.println(a == b); System.out.println(c == d);
operator ==
What will be the output of the following code: public static void main(String[] args) { int i = 10; Integer x = new Integer(10); if(x == i) { System.out.print("true"); } else { System.out.print("false"); } }
operator ==
What will be the output of the following code? Integer foo = 1000; Integer bar = 1000; System.out.println(foo <= bar); System.out.println(foo >= bar); System.out.println(foo == bar);
operator ==
import java.io.File; import java.util.Date; public class ReferenceDemo { public static void main(String [] args) { File f1 = new File("mydata.txt"); File f2 = new File("mydata.txt"); if (f1 != f2) System.out.println("f1 != f2"); Date today = new Date(); Date now = today; if (today == now) System.out.println("today == now"); String s1 = "Hello"; String s2 = "Hello"; if (s1 == s2) System.out.println("s1 == s2"); String x1 = new String("Goodbye"); String x2 = new String("Goodbye"); if (x1 == x2) System.out.println("x1 == x2"); } } What will be printed out?
operator ==
What will be the result of running the following code? public class Test { public static void main(String[] args){ float x = 0, y = 0; x = (float) (0.3 + 0.4); y = 0.3f + 0.4f; System.out.println(x==y); } }
operator ==
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes