Exam Code/Number: | 1Z0-803Join the discussion |
Exam Name: | Java SE 7 Programmer I |
Certification: | Oracle |
Question Number: | 216 |
Publish Date: | Sep 26, 2025 |
Rating
100%
|
Given: What should statement1, statement2, and statement3, be respectively, in order to produce the result?
Shape: constructor Square: foo Shape: foo
View the Exhibit.
public class Hat {
public int ID =0;
public String name = "hat";
public String size = "One Size Fit All";
public String color="";
public String getName() { return name; }
public void setName(String name) {
this.name = name;
}
}
Given
public class TestHat {
public static void main(String[] args) {
Hat blackCowboyHat = new Hat();
}
}
Which statement sets the name of the Hat instance?
TION NO: 77
Given:
public class Main {
public static void main(String[] args) {
try {
doSomething();
}
catch (SpecialException e) {
System.out.println(e);
}}
static void doSomething() {
int [] ages = new int[4];
ages[4] = 17;
doSomethingElse();
}
static void doSomethingElse() {
throw new SpecialException("Thrown at end of doSomething() method"); }
}
What is the output?
Given:
Which two classes use the shape class correctly?