Which code fragment, when inserted at line 14, enables the code to print Mike Found?

Given: Which code fragment, when inserted at line 14, enables the code to print Mike
Found?

Given: Which code fragment, when inserted at line 14, enables the code to print Mike
Found?

A.
int f = ps.indexOf(p2);

B.
int f = ps.indexOf {new patient (“Mike”)};

C.
int f = ps.indexOf (patient(“Mike”));

D.
patient p = new Patient (“Mike”); int f = pas.indexOf(P)



Leave a Reply 7

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


MUKESH GUPTA

MUKESH GUPTA

1Z0-803
Yeah! Just completed 1Z0-803 exam few days ago! Scored 92% (the passing line is 63% now)!!

I had 70 questions in my actual 1Z0-803 test.

Most of the questions are on Giving Code … tell the result, insert CODE, choose the best option …etc.

Only few questions on Java: advantages of the Java exception mechanism, benefits of using ArrayList over array, valid types for switch, Java Exception classes, two-dimensional array, improve the encapsulation of a class, java class declaration … and so on.

Learned valid 1Z0-803 dumps from PassLeader (http://www.passleader.com/1z0-803.html) (272q VCE and PDF), almost all questions were same as my 1Z0-803 exam, valid enough for passing until now!

renko

renko

Answer: A

Code question:
public class Patient {
String name;
public Patient (String name) {
this.name = name;
}

}
import java.util.ArrayList;

public class Test {
public static void main(String[] args) {
ArrayList ps = new ArrayList();
Patient p2 = new Patient(“Mike”);
ps.add(p2);

// insert code here
//int f = ps.indexOf{new Patient(“Mike”)}; //
//int f = ps.indexOf(patient(“Mike”)); //
//patient p = new Patient (“Mike”); int f = ps.indexOf(p2); //P v.s.p
int f = ps.indexOf(p2); //

if(f >= 0) {
//System.out.println(f);
System.out.println(“Mike Found”);
}
}

}
Output:
Mike Found
BUILD SUCCESSFUL (total time: 0 seconds)