Given:


Given the code fragment:

Consider below code of Test.java file:
1. package com.sampleproject.oca;
2.
3. interface Perishable1 {
4. default int maxDays() {
5. return 1;
6. }
7. }
8.
9. interface Perishable2 extends Perishable1 {
10. default int maxDays() {
11. return 2;
12. }
13. }
14.
15. class Milk implements Perishable2, Perishable1 {}
16.
17. public class Test {
18. public static void main(String[] args) {
19. Perishable1 obj = new Milk();
20. System.out.println(obj.maxDays());
21. }
22. }
Which of the following statements is correct?
Consider below codes of 3 java files:
1. //Super.java
2. package com.sampleproject.oca;
3.
4. public interface Super {
5. String name = "SUPER"; //Line n1
6. }
1. //Sub.java
2. package com.sampleproject.oca;
3.
4. public interface Sub extends Super { //Line n2
5.
6. }
1. //Test.java
2. package com.sampleproject.oca;
3.
4. public class Test {
5. public static void main(String[] args) {
6. Sub sub = null;
7. System.out.println(sub.name); //Line n3
8. }
9.
Which of the following statements is correct?
Given the code fragment:

© Copyrights Oracledumps 2026. All Rights Reserved
We use cookies to ensure that we give you the best experience on our website (Oracledumps). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the Oracledumps.