The java.util.Date class is introduced in this section. Analyze the following code and choose the best answer :
Which of the following code in A or B, or both creates an object of the Date class:
```
A:
public class Test {
public Test() {
new java.util.Date();
}
}
B:
public class Test {
public Test() {
java.util.Date date = new java.util.Date();
}
}```
a. A.
b. B.
c. Neither
ab Both (A) and (B) are fine. In A, an object is created without explicit reference. This is known as anonymous object.
Computer Science & Information Technology
You might also like to view...
If you want to chart trends over time, you should use a ________ chart
A) scatter B) pie C) bar D) line
Computer Science & Information Technology
Which of the following statements is true?
a. The capacity of a StringBuilder is equal to its length. b. The capacity of a StringBuilder cannot exceed its length. c. The length of a StringBuilder cannot exceed its capacity. d. Both a and b are true.
Computer Science & Information Technology