Sams Teach Yourself Java in 21 Days (Covering Java 8 and Android)
HOME / FEEDBACK / ORDER THE BOOK / OTHER BOOKS / PREVIOUS DAY / NEXT DAY / THANKS
ROGERS CADENHEAD

Day 18: Accessing Databases with JDBC

Certification Practice

Each chapter of the book ends with a Certification Practice question that's comparable to what you could expect to be asked on a Java certification test. Here's the answer for chapter 18:

Answer (a) is correct. The compiler fails with the error message "non-static variable count cannot be referenced from a static context."

Answer (b) is incorrect. You can use the new operator along with the constructor method of a class anywhere an object of that class would be expected.

Answer (c) is incorrect. The [] that is used to declare an array can be placed after the variable name instead of the class or data type.

Answer (d) is incorrect. Class variables can be declared anywhere outside of the methods of a class, not just at the top of the class definition. Edit

Return to Day 18

HOME / FEEDBACK / ORDER THE BOOK / OTHER BOOKS / PREVIOUS DAY / NEXT DAY / THANKS

Valid HTML 4.01!

Valid CSS!