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);
Every Double object (starts with upper case) is a different instance and has it's own address in a memory. As operator == compares object references, and not values, Result will be false.

@holladj04 It should be right ;)

2017 May 17, 11:44:38 PM

Correct the answer please.

2016 Nov 11, 4:12:06 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes