OCA Java SE 8 Mock Exam - OCA Mock Question 36
Question
Which of the following statements are true?
- A Java class can define multiple methods.
- A Java class can define multiple variables.
- A Java class can be defined in multiple packages.
- A Java class can import multiple packages.
- A Java class can't define more than 1024 constructors.
- End-of-line comments can't follow import or package statements.
- Multiline comments can only be defined within a method definition.
Answer
Note
C is incorrect. The same class can't be defined in multiple
packages.
E is incorrect because there is no limit on the number of constructors that can be defined by a class.
F is incorrect because end-of-line comments can follow any line of code.
G is incorrect because multiline comments can also be placed outside a method definition.