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 valuable questions:

    Look at the aftercited rule. The order in outoutsuccession conquer override the order in outoutsuccession Outsuccession 1 open tabulate TabulateA Outsuccession 2 Outsuccession 3 open TabulateA() f) Outsuccession 4open int order1 (int a) Outsuccession 5 open int order2 (int b) i> Outsuccession 6) Outsuccession 7 open TabulateB extends Tabulatei Outsuccession 8 Outsuccession 9 Outsuccession 10 open int order1 (int b) i> Outsuccession 11 open int order2 (double c) Outsuccession 12) O 4, 10 O 5, 11 O 10, 4 open TabulateB)) 11, 5 Twain 4, 10 and 5, 11

    Look at the aftercited rule. The order in outoutsuccession conquer override the order in outoutsuccession Outsuccession 1 open tabulate TabulateA Outsuccession 2 Outsuccession 3 open TabulateA() f) Outsuccession 4open int order1 (int a) Outsuccession 5 open int order2 (int b) i> Outsuccession 6) Outsuccession 7 open TabulateB extends Tabulatei Outsuccession 8 Outsuccession 9 Outsuccession 10 open int order1 (int b) i> Outsuccession 11 open int order2 (double c) Outsuccession 12) O 4, 10 O 5, 11 O 10, 4 open TabulateB)) 11, 5 Twain 4, 10 and 5, 11

    Expert Tally

     

    Question :  look at the aftercited rule. the order in outline—- conquer override the order in outline….

    ANSWER : Twain 4,10 and 5,11

    Explanation:

    Overriding :
    A order in a subtabulate having the corresponding verification as a order in the super tabulate

    Question : what is evil-doing with the aftercited rule?

    IntCalculator balance = upstart IntCalculator() {
    open int enumerate(int enumerate)
    {
    return int enumerate (int enumerate)
    }
    }

    ANSWER : The interior braces are not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable needed

    Explanation :

    • Balance is an Object sothat upstart keyword is must be declared
    • The outside braces are necessitated why owing enumerate of assertion enumerate conquer be two
    • The interior braces are not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable needed why owing here is a separate assertion
    • return assertion is ends with semicolon.

    Question 15 : Defended portions are : —

    ANSWER : Twain not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable entirely retired and not attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable attributable entirely open

    Explanation:

    • A defended nonstatic vile tabulate portion and can be used to endanger recent customization options extraneously unnecessarily complicating the main open interface.
    • Public, retired, defended are designated Access Modifiers
    • Defended is further arrest than the twain open and retired.

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

    ANSWER : All of these

    Explanation:

    1. Lambda countenances are used primarily to specify inoutsuccession implementation of a negotiative interface, i.e., an interface with a separate order simply.
    2. Lambda countenance gives a masterful negotiative programming cleverness to Java.