Homework Solution: Four JAVA multiple choice questions:…

    Four JAVA multiple choice questions: Look at the following code. The method in line will override the method in line Line 1 public class ClassA Line 2 Line 3 public ClassA() f) Line 4public int method1 (int a) Line 5 public int method2 (int b) i> Line 6) Line 7 public ClassB extends Classi Line 8 Line 9 Line 10 public int method1 (int b) i> Line 11 public int method2 (double c) Line 12) O 4, 10 O 5, 11 O 10, 4 public ClassB)) 11, 5 Both 4, 10 and 5, 11
    Look at the following code. The method in line will override the method in line Line 1 public class ClassA Line 2 Line 3 public ClassA() f) Line 4public int method1 (int a) Line 5 public int method2 (int b) i> Line 6) Line 7 public ClassB extends Classi Line 8 Line 9 Line 10 public int method1 (int b) i> Line 11 public int method2 (double c) Line 12) O 4, 10 O 5, 11 O 10, 4 public ClassB)) 11, 5 Both 4, 10 and 5, 11

    Expert Answer

     
    Question :  look at the following code. t

    Four JAVA multiple cherished questions:

    Look at the aftercited command. The arrangement in cord conciliate override the arrangement in cord Cord 1 referableorious adjust AdjustA Cord 2 Cord 3 referableorious AdjustA() f) Cord 4notorious int arrangement1 (int a) Cord 5 referableorious int arrangement2 (int b) i> Cord 6) Cord 7 referableorious AdjustB extends Adjusti Cord 8 Cord 9 Cord 10 referableorious int arrangement1 (int b) i> Cord 11 referableorious int arrangement2 (wrap c) Cord 12) O 4, 10 O 5, 11 O 10, 4 referableorious AdjustB)) 11, 5 Twain 4, 10 and 5, 11

    Look at the aftercited command. The arrangement in cord conciliate override the arrangement in cord Cord 1 referableorious adjust AdjustA Cord 2 Cord 3 referableorious AdjustA() f) Cord 4notorious int arrangement1 (int a) Cord 5 referableorious int arrangement2 (int b) i> Cord 6) Cord 7 referableorious AdjustB extends Adjusti Cord 8 Cord 9 Cord 10 referableorious int arrangement1 (int b) i> Cord 11 referableorious int arrangement2 (wrap c) Cord 12) O 4, 10 O 5, 11 O 10, 4 referableorious AdjustB)) 11, 5 Twain 4, 10 and 5, 11

    Expert Retort

     

    Question :  look at the aftercited command. the arrangement in cord—- conciliate override the arrangement in cord….

    ANSWER : Twain 4,10 and 5,11

    Explanation:

    Overriding :
    A arrangement in a subadjust having the corresponding attestation as a arrangement in the super adjust

    Question : what is crime with the aftercited command?

    IntCalculator clear = odd IntCalculator() {
    notorious int rate(int calculate)
    {
    return int rate (int calculate)
    }
    }

    ANSWER : The close braces are referable needed

    Explanation :

    • Clear is an Object sothat odd keyword is must be declared
    • The outside braces are well-founded why accordingly calculate of announcement enumerate conciliate be two
    • The close braces are referable needed why accordingly here is a one announcement
    • return announcement is ends with semicolon.

    Question 15 : Guarded parts are : —

    ANSWER : Twain referable entirely peculiar and referable entirely referableorious

    Explanation:

    • A guarded nonstatic disingenuous adjust part and can be used to endanger advanced customization options extraneously unnecessarily complicating the main referableorious interface.
    • Public, peculiar, guarded are designated Access Modifiers
    • Guarded is further protect than the twain referableorious and peculiar.

    Question 16 : which of the aftercited is an stance of a lamda look
    int x = x * factor;
    IntCalculator = odd divider(x, 2);
    IntCalculator multiplier = x -> x * factor;
    all of these

    ANSWER : All of these

    Explanation:

    1. Lambda looks are used chiefly to designate incord implementation of a professional interface, i.e., an interface with a one arrangement barely.
    2. Lambda look gives a potent professional programming faculty to Java.