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-804





Question ID 21421

Which two forms of abstraction can a programmer use in Java?

Option A

enums

Option B

interfaces

Option C

primitives

Option D

abstract classes

Option E

concrete classes

Option F

primitive wrappers

Correct Answer B,D
Explanation Explanation: *When To Use Interfaces An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package. The disadvantage is every method in the interface must be public. You might not want to expose everything. *When To Use Abstract classes An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class. *When to Use Both You can offer the best of both worlds, an interface and an abstract class. Implementors can ignore your abstract class if they choose. The only drawback of doing that is calling methods via their interface name is slightly slower than calling them via their abstract class name. Reference:http://mindprod.com/jgloss/interfacevsabstract.html


Question ID 21422

Given:
class Plant {
abstract String growthDirection();
}

class Embryophyta extends Plant {
String growthDirection() { return "Up " }
}
public class Garden {
public static void main(String[] args) {
Embryophyta e = new Embryophyta();
Embryophyta c = new Carrot();
System.out.print(e.growthDirection() + growthDirection());
}
}
What is the result?

Option A

Up Down

Option B

Up Up

Option C

Up null

Option D

Compilation fails

Option E

An exception is thrown at runtime

Correct Answer D
Explanation Explanation: Compiler: Der Typ Plant muss eine abstrakte Klasse sein um abstrakte Methoden zu definieren alte Lösung E: offensichtlich fehlt die Deklaration der Klasse Carrot, wer weiß schon, wie die originale Aufgabe aussah aber Plant muss abstract sein, insofern bleibt's dabei ------ Exception in thread "main" java.lang.ExceptionInInitializerError at garden.Garden.main Caused by: java.lang.RuntimeException: Uncompilable source code - garden.Plant is not abstract and does not override abstract method growthDirection() in garden.

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