AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-851





Question ID 3730

Given:
1.    class Pizza {
2.    java.util.ArrayList toppings;
3.    public final void addTopping(String topping) {
4.    toppings.add(topping);
5.    }
6.    }
7.    public class PepperoniPizza extends Pizza {
8.    public void addTopping(String topping) {
9.    System.out.println("Cannot add Toppings");
10.    }
11.    public static void main(String[] args) {
12.    Pizza pizza = new PepperoniPizza();
13.    pizza.addTopping("Mushrooms");
14.    }
15.    }
What is the result?
 

 

Option A

A.    Compilation fails.
 

Option B

B.    Cannot add Toppings
 

Option C

C.    The code runs with no output.
 

Option D

D.    A NullPointerException is thrown in Line 4.
 

Correct Answer A
Explanation


Question ID 3731

Given two files, GrizzlyBear.java and Salmon.java:
1.    package animals.mammals;
2.    
3.    public class GrizzlyBear extends Bear {
4.    void hunt() {
5.    Salmon s = findSalmon();
6.    s.consume();
7.    }
8.    }
1.    package animals.fish;
2.    
3.    public class Salmon extends Fish {
4.    public void consume() { /* do stuff */ }
5. }
If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?
 

Option A

A.    add import animals.mammals.*; at line 2 in Salmon.java
 

Option B

B.    add import animals.fish.*; at line 2 in GrizzlyBear.java
 

Option C

C.    add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
 

Option D

D.    add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java
 

Correct Answer B
Explanation

Send email to admin@getfreedumps for new dumps request!!!