Question 6

Given the code fragment:

Which code fragment, when inserted at line n1, enables the App class to print Equal?
  • Question 7

    Given the following two classes:

    How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate?
    Any amount of electricity used by a customer (represented by an instance of the customer class) must contribute to the customer's bill (represented by the member variable bill) through the method useElectricity method. An instance of the customer class should never be able to tamper with or decrease the value of the member variable bill.
  • Question 8

    Given the code fragment:

    Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)
  • Question 9

    Which is true about the switchstatement?
  • Question 10

    int i, j=0;
    i = (3* 2 +4 +5 ) ;
    j = (3 * ((2+4) + 5));
    System.out.println("i:"+ i + "\nj":+j);
    What is the result?