1.9. Sample exam questions
Given:
class EJava { //..code }Which of the following options will compile?
package java.oca.associate; class Guru { EJava eJava = new EJava(); } package java.oca; import EJava; class Guru { EJava eJava; } package java.oca.*; import java.default.*; class Guru { EJava eJava; } package java.oca.associate; import default.*; class Guru { default.EJava eJava; }- None of the above
The following numbered list of Java class components is not in any particular order. Select the acceptable order of their occurrence in any Java class (choose all that apply):
- comments
- import statement
- package statement
- methods
- class declaration
- variables
- 1, 3, 2, 5, 6, 4
- 3, 1, 2, 5, 4, 6
- 3, 2, 1, 4, ...
Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.