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

public interface Foo { int k = 4; /* Line 3 */ } Which three piece of codes are equivalent to line 3? 1 final int k = 4; 2 public int k = 4; 3 static int k = 4; 4 abstract int k = 4; 5 volatile int k = 4; 6 protected int k = 4;

  • Home
  • Computer Science & Engineering
  • Java Programming Questions and Answers
  • Language Fundamentals - General Questions
  • Discuss - 1314
1. 

public interface Foo
{
int k = 4; /* Line 3 */
}

Which three piece of codes are equivalent to line 3?

1 final int k = 4;

2 public int k = 4;

3 static int k = 4;

4 abstract int k = 4;

5 volatile int k = 4;

6 protected int k = 4;

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

Answer: Option A

Explanation:

(1), (2) and (3) are correct. Interfaces can have constants, which are always implicitly public, static, and final. Interface constant declarations of public, static, and final are optional in any combination.

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
© 2026 IndiaBIX. All Rights Reserved.

Report