IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Which two of the following are legal declarations for nonnested classes and interfaces? 1 final abstract class Test {} 2 public static interface Test {} 3 final public class Test {} 4 protected abstract class Test {} 5 protected interface T

  • Home
  • Computer Science & Engineering
  • Java Programming Questions and Answers
  • Declarations and Access Control - General Questions
  • Discuss - 1379
1. 

Which two of the following are legal declarations for nonnested classes and interfaces?

1 final abstract class Test {}

2 public static interface Test {}

3 final public class Test {}

4 protected abstract class Test {}

5 protected interface Test {}

6 abstract public class Test {}

[A]. 1 and 4
[B]. 2 and 5
[C]. 3 and 6
[D]. 4 and 6

Answer: Option C

Explanation:

(3), (6). Both are legal class declarations.

(1) is wrong because a class cannot be abstract and final—there would be no way to use such a class. (2) is wrong because interfaces and classes cannot be marked as static. (4) and (5) are wrong because classes and interfaces cannot be marked as protected.

Workspace Report
Leave a Comment

Computer Science & Engineering :: Java Programming Questions and Answers : More Exercises

  • Language Fundamentals - General Questions
  • Operators and Assignments - Finding the output
  • Exceptions - Finding the output
  • Inner Classes - General Questions
  • Height and Distance - Garbage Collections
  • Java.lang Class - General Questions
  • Declarations and Access Control - General Questions
  • Flow Control - General Questions
  • Objects and Collections - General Questions
  • Threads - General Questions
  • Assertions - Finding the output

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2025 IndiaBIX. All Rights Reserved.

Report