최신 1z0-808 무료덤프 - Oracle Java SE 8 Programmer I
What is the proper way to defined a method that take two int values and returns their sum as an int value?
정답: E
설명: (DumpTOP 회원만 볼 수 있음)
Given:
and the code fragment:
What is the result?
and the code fragment:
What is the result?
정답: C
Given:
What is the result?
What is the result?
정답: A
Given:
Which two code fragments can be inserted at line n1?
Which two code fragments can be inserted at line n1?
정답: A,B
Given the following main method:
What is the result?
What is the result?
정답: E
설명: (DumpTOP 회원만 볼 수 있음)
Given:
package p1;
public interface DoInterface {
void method1(int n1); // line n1
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface {
public DoClass(int p1) { }
public void method1(int p1) { } // line n2
private void method2(int p1) { } // line n3
}
public class Test {
public static void main(String[] args) {
DoInterface doi= new DoClass(100); // line n4
doi.method1(100);
doi.method2(100);
}
}
Which change will enable the code to compile?
package p1;
public interface DoInterface {
void method1(int n1); // line n1
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface {
public DoClass(int p1) { }
public void method1(int p1) { } // line n2
private void method2(int p1) { } // line n3
}
public class Test {
public static void main(String[] args) {
DoInterface doi= new DoClass(100); // line n4
doi.method1(100);
doi.method2(100);
}
}
Which change will enable the code to compile?
정답: C
설명: (DumpTOP 회원만 볼 수 있음)
Given:
class MarksOutOfBoundsException extends IndexOutOfBoundsException { }
public class GradingProcess {
void verify(int marks) throws IndexOutOfBoundsException { if (marks >
100) {
throw new MarksOutOfBoundsException();
}
if (marks > 50) {
System.out.print("Pass");
} else {
System.out.print("Fail");
}
}
public static void main(String[] args) {
int marks = Integer.parseInt(args[2]);
try {
new GradingProcess().verify(marks);
} catch (Exception e) {
System.out.print(e.getClass());
}
}
}
And the command line invocation:
java GradingProcess 89 50 104
What is the result?
class MarksOutOfBoundsException extends IndexOutOfBoundsException { }
public class GradingProcess {
void verify(int marks) throws IndexOutOfBoundsException { if (marks >
100) {
throw new MarksOutOfBoundsException();
}
if (marks > 50) {
System.out.print("Pass");
} else {
System.out.print("Fail");
}
}
public static void main(String[] args) {
int marks = Integer.parseInt(args[2]);
try {
new GradingProcess().verify(marks);
} catch (Exception e) {
System.out.print(e.getClass());
}
}
}
And the command line invocation:
java GradingProcess 89 50 104
What is the result?
정답: B
Which three are valid replacements for foo so that the program will compiled and run?
public class ForTest {
public static void main(String[] args) {
int[] arrar = {1,2,3};
for ( foo ) {
}
}
}
public class ForTest {
public static void main(String[] args) {
int[] arrar = {1,2,3};
for ( foo ) {
}
}
}
정답: B,C,E
Consider following interface.
Which of the following will create instance of Runnable type?
Which of the following will create instance of Runnable type?
정답: A
설명: (DumpTOP 회원만 볼 수 있음)
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?
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?
정답: B
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.
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.
정답: C
Given the code fragment:
What is the result?
What is the result?
정답: C
설명: (DumpTOP 회원만 볼 수 있음)
Given:
What is the output?
What is the output?
정답: B
설명: (DumpTOP 회원만 볼 수 있음)