x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

Methods and data members of a class/interface in java can have one of the following four access specifiers.  1) private (class specific) 2) default (when no access specifier is specified, package specific) 3) protected (used in inheritence) 4) public (visible to all packages classes and subclasses)

The classes and interfaces themselves can have only two access specifiers when declared outside any other class. 1) public 2) default (when no access specifier is specified)

We cannot declare class/interface with private or protected access specifiers. For example, following program fails in compilation.

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer