Which two modifications, when made independently, enable the code to print joe:true: 100.0?

Given the code fragment:

Which two modifications, when made independently, enable the code to print joe:true: 100.0?

A. Option A
B. Option B
C. Option C
D. Option D
E. Option E

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which two modifications, when made independently, enable the code to print joe:true: 100.0?

  1. AC
    public class Q126 {
    String name;
    double salary;
    boolean contract;
    Q126 (){
    //C
    this.name = new String(“Joe”);
    this.contract=new Boolean(true);
    this.salary=new Double(100);

    //D is correct if contract is true
    // name=”Joe”;
    // salary = 100.0f;
    // contract = TRUE;//fail to compile TRUE
    }
    public String toString(){
    return name +”:”+contract+”:”+salary;
    }

    public static void main(String[] args) {
    Q126 e = new Q126();
    //A
    e.name=”Joe”;
    e.salary=100.0;
    e.contract=true;
    System.out.println(e);
    }

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.