Each break statement terminates the enclosing switch statement. Control flow continues with the first statement following the switch block. The break statements are necessary because without them, statements in switch blocksfall through: All statements after the matching case label are executed in sequence, regardless of the expression of subsequent case labels, until a break statement is encountered. QUESTION 18 Which two may precede the word "class" in a class declaration? A. local B. public C. static D. volatile E. synchronized Answer: BC Explanation: B: A class can be declared as public or private. C: You can declare two kinds of classes: top-level classes and inner classes. You define an inner class within a top-level class. Depending on how it is defined, an inner class can be one of the following four types:Anonymous, Local, Member and Nested top-level. A nested top-level class is a member classes with astaticmodifier.
100% Exam Pass And 100% Money Back EnsurePassLeader -- 3200+ Exam Brain Dumps With 30,000,000+ Customers’ TrustA nested top-level class is just like any other top-level class except that it is declared within another class or interface. Nested top-level classes are typically used as a convenient way to group related classes without creating a new package. The following is an example: public class Main { static class Killer { QUESTION 19 Which three are bad practices? A. Checking for ArrayindexoutofBoundsException when iterating through an array to determinewhen all elements have been visited B. Checking for Error and. If necessary, restartingthe program to ensure that users are unaware problems C. Checking for FileNotFoundException to inform a user that a filename entered is not valid D. Checking for ArrayIndexoutofBoundsExcepcion and ensuring that the program can recover if one occur E. Checking for an IOException and ensuring that the program can recover if one occurs Answer: ABD QUESTION 20 Given: public class Bark { // Insert code here - Line 5 public abstract void bark(); // Line 6 } // Line 7 // Line 8 // Insert code here - Line 9 public void bark() { System.out.println("woof"); } } What code should be inserted? 9. public class Poodle extends Dog { D. 5.abstract Dog { 9.public class Poodle implements Dog { E. 5. abstractDog { 9. public class Poodle implements Dog { F. 5.abstract class Dog { 9.public class Poodle implements Dog { Answer: C Explanation: Dog should be an abstract class. The correct syntax for this is: abstract class Dog { Poodle should extend Dog (not implement).