It is impossible to pass Oracle 1z0-808 exam without any help in the short term. Come to Testking soon and find the most advanced, correct and guaranteed Oracle 1z0-808 practice questions. You will get a surprising result by our Renewal Java SE 8 Programmer I practice guides.

2016 Dec 1z0-808 simulations

Q121. 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 

Answer:


Q122. Given: 

What will be the output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q123. Given: 

What is the result? 

A. simaple A 

B. Capital A 

C. simaple A default Capital A 

D. simaple A default 

E. Compilation fails. 

Answer:

Explanation: 

Here we have to use two ternary operators combined. SO first we can use to check first 

condition which is x > 10, as follows; 

x>10?">": (when condition false) Now we have to use another to check if x<10 as follows; 

x<10?V:"=" We can combine these two by putting last ternary statement in the false 

position of first ternary statement as follows; 

x>10?">":x<10?'<':"=" 

https;//docs.oraclexom/javase/tutorial/java/nutsandbolts/if.html 


Q124. Given: 

public class Equal { 

public static void main(String[] args) { 

String str1 = "Java"; 

String[] str2 = {"J","a","v","a"}; 

String str3 = ""; 

for (String str : str2) { 

str3 = str3+str; 

boolean b1 = (str1 == str3); 

boolean b2 = (str1.equals(str3)); 

System.out.print(b1+", "+b2); 

What is the result? 

A. true, false 

B. false, true 

C. true, true 

D. false, false 

Answer:

Explanation: == strict equality. equals compare state, not identity. 


Q125. Given the code fragment: 

class Student { 

int rollnumber; 

String name; 

List cources = new ArrayList(); 

// insert code here 

public String toString() { 

return rollnumber + " : " + name + " : " + cources; 

And, 

public class Test { 

public static void main(String[] args) { 

List cs = newArrayList(); 

cs.add("Java"); 

cs.add("C"); 

Student s = new Student(123,"Fred", cs); 

System.out.println(s); 

Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]? 

A. 

private Student(int i, String name, List cs) { 

/* initialization code goes here */ 

B. 

public void Student(int i, String name, List cs) { 

/* initialization code goes here */ 

C. 

Student(int i, String name, List cs) { 

/* initialization code goes here */ 

D. 

Student(int i, String name, ArrayList cs) { 

/* initialization code goes here */ 

Answer:

Explanation: 

Incorrect: 

Not A: Student has private access line: Student s = new Student(123,"Fred", cs); 

Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs); 


Updated 1z0-808 free question:

Q126. Given the code fragment: 

Which three code fragments can be independently inserted at line nl to enable the code to print one? 

A. Byte x = 1; 

B. short x = 1; 

C. String x = "1"; 

D. Long x = 1; 

E. Double x = 1; 

F. Integer x = new Integer ("1"); 

Answer: A,B,F 


Q127. Given: 

A. ns = 50 S = 125 ns = 125 S = 125 ns = 100 S = 125 

B. ns = 50 S = 125 ns = 125 S = 125 ns = 0 S = 125 

C. ns = 50 S = 50 ns = 125 S = 125 ns = 100 S = 100 

D. ns = 50 S = 50 ns = 125 S = 125 ns = 0 S = 125 

Answer:


Q128. Given the code fragment from three files: 

Which code fragment, when inserted at line 2, enables the code to compile? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer:


Q129. Which of the following data types will allow the following code snippet to compile? 

A. long 

B. double 

C. int 

D. float 

E. byte 

Answer: B,D 

Explanation: 

Option B and D are the correct answer. 

Since the variables I and j are floats, resultant will be float type too. So we have to use float 

or primitive type which can hold float, such a primitive type is double, it has wider range 

and also can hold floating point numbers, hence we can use double or float for the blank. 

As explained above options B and D are correct. 

long and int can't be used with floating point numbers so option A is incorrect. 

Option E is incorrect as it have smaller range and also can't be used with floating point 

numbers. 

hnpsy/docs.oracle.com/javase/tutorial/java/javaOO/variables.html 


Q130. Given: 

And given the commands: 

javac Test.Java 

Java Test Hello 

What is the result? 

A. Success 

B. Failure 

C. Compilation fails. 

D. An exception is thrown at runtime 

Answer: