What is the result?

Given:

What is the result?
A. true:true
B. true:false
C. false:true
D. false:false

Download Printable PDF. VALID exam to help you PASS.

3 thoughts on “What is the result?

  1. public class Q77 {
    int id;
    String name;
    Q77(int id,String name){
    this.id=id;
    this.name=name;
    }

    public static void main(String[] args) {
    Q77 p1 = new Q77(101,”Pen”);
    Q77 p2 = new Q77(101,”Pen”);
    Q77 p3 = p1;
    boolean ans1 = p1 == p2;
    boolean ans2 = p1.name.equals(p2.name);
    System.out.println(ans1+” : “+ ans2);
    }
    }
    result : false : true

Leave a Reply

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


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