Solved

The Program Has a Syntax Error Because the Member Access

Question 11

Essay

The program has a syntax error because the member access operator The java.util.Date class implements java.lang.Cloneable and overrides the equals method to return true if two objects have the same date and time. Show the output of the following code.
import java.util.*;
public class Test extends Object {
public static void main(String[] args) {
Date d1 = new Date();
Date d2 = new Date(349324);
Date d3 = d1;
System.out.println("(1) " + (d1 == d2));
System.out.println("(2) " + (d1 == d3));
System.out.println("(3) " + d1.equals(d2));
System.out.println("(4) " + d1.equals(d3));
}
}

Correct Answer:

verifed

Verified

public void m2() {pu...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents