To resolve the issue and have option B compile, you need to add an additional pair of braces: Q:5 A JavaBeans component has the following field: 11. Private Boolean value enabled. What are the two pairs of method declarations that follow the JavaBeans standard to access this field? (Select two.) A. public void setEnabled( boolean enabled ) public boolean getEnabled() B. public void setEnabled( boolean enabled ) public void isEnabled() C. public void setEnabled( boolean enabled ) public boolean isEnabled() Although this may sound like writing a novel rather than simply declaring a method for a class, most method attributes can be declared implicitly. The only two mandatory elements of a method declaration are the name of the method and the type of data returned by the method. For example, the following method declares a method named isEmpty() in the Stack class that returns a Boolean value (true or false): The compiler distinguishes methods by the number and type of arguments passed to the method. Therefore, draw(String s) and draw(int i) are different and unique methods. You cannot declare multiple methods with the same signature: draw(String s) and draw(String t) are identical and result in a compiler error. Note that overloaded methods must return the same data type.

Therefore, void draw(String s) and int draw(String t) declared in the same class produce a compile error. Methods can return primitive data type values or reference data types. The isEmpty() method of the Stack class returns a primitive data type, a Boolean value: What is the most restrictive access modifier that allows members of one class to access members of another class in the same package? What code should be inserted on line 1 of Demo .java compile and run Demo to print “pizzapizza”? a. Imports-Uses.*; B. Static import uses.*; C. Imports-Uses. Repetition.*; D. Static Import Uses. Repetition.*; E. Imports-Uses.

repeat.twice(); F. Import static utilities. Repetition.twice; G. Static Import Uses. Repetition.twice; Answer: F D. public boolean setEnabled( boolean enabled ) public boolean getEnabled() Answer: A, C What are the two true statements? (Select two.) A. Foo.beta() is a valid call to beta(). B. Foo.alpha() is a valid call to alpha(). C. The beta() method can call the alpha() method directly. D.

The alpha() method can call the beta() method directly. Answer: B, C Q: 1 given 10.class Foo { 11. static void alpha() { /* more code here */ } 12. void beta() { /* more code here */ }Page 1 of 182Warning: 13. } The data type of the value returned by the return statement must match the type of data that the method should return. You cannot return an object from a declared method to return an integer. When returning an object, the data type of the returned object must be a subclass of or exactly the specified class. When returning an interface type, the returned object must implement the specified interface.

Q: 2 given: 12. Yippee2 public class { 13. 14. static public void main(String [] yahoo) { 15. for(int x = 1; x < yahoo.length; x++) { 16. System.out.print(yahoo[x] + " "); 17. } 18. } 19. } and the command line call: java Yippee2 a b c Options A and C are incorrect because public and protected are less restrictive. Options B and D are incorrect because abstract and synchronized are not access modifiers. The default access modifier is the packet-oriented access modifier. The last three links in the list cover topics that warrant their own lesson or have already been included in another lesson.

Selecting these links will take you to another part of this tutorial. Definitely come back!.