Go Back on 1z0-808 Exam
Available in 1, 3, 6 and 12 Months Free Updates Plans
PDF: $15 $60

Test Engine: $20 $80

PDF + Engine: $25 $99

1z0-808 Practice Test


Page 5 out of 48 Pages

Given:

What is the result?


A.

myStr: 9009, myNum: 9009


B.

myStr: 7007, myNum: 7007


C.

myStr: 7007, myNum: 9009


D.

Compilation fails





C.
  

myStr: 7007, myNum: 9009



Given:
import java.util.*;
public class Ref {
public static void main(String[] args) {
StringBuilder s1 = new StringBuilder("Hello Java!");
String s2 = s1.toString();
List<String> lst = new ArrayList<String>();
lst.add(s2);
System.out.println(s1.getClass());
System.out.println(s2.getClass());
System.out.println(lst.getClass());
}
}
What is the result?


A.

class java.lang.String
class java.lang.String
class java.util.ArrayList


B.

class java.lang.Object
class java.lang. Object
class java.util.Collection


C.

class java.lang.StringBuilder
class java.lang.String
class java.util.ArrayList


D.

class java.lang.StringBuilder
class java.lang.String
class java.util.List





C.
  

class java.lang.StringBuilder
class java.lang.String
class java.util.ArrayList



class java.lang.StringBuilder
class java.lang.String
class java.util.ArrayList

Given the code fragment:

What is the result?


A.

 true true


B.

True false


C.

false false


D.

false true


L.

       





C.
  

false false



Given:
public class TestField {
int x;
int y;
public void doStuff(int x, int y) {
this.x = x;
y =this.y;
}
public void display() {
System.out.print(x + " " + y + " : ");
}
public static void main(String[] args) {
TestField m1 = new TestField();
m1.x = 100;
m1.y = 200;
TestField m2 = new TestField();
m2.doStuff(m1.x, m1.y);
m1.display();
m2.display();
}
}
What is the result?


A.

100 200 : 100 200


B.

100 0 : 100 0 :


C.

 100 200 : 100 0 :


D.

100 0 : 100 20





C.
  

 100 200 : 100 0 :



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.



A.

Option A


B.

Option B


C.

Option C


D.

Option D





B.
  

Option B




Page 5 out of 48 Pages
Previous