in Education by
How can a protected modifier be accessed? (a) accessible only within the class (b) accessible only within package (c) accessible within package and outside the package but through inheritance only (d) accessible by all This question was addressed to me in a job interview. I would like to ask this question from Access Control in section Classes and Methods of Java Select the correct answer from above options Java questions and answers, Java questions pdf, Java question bank, Java questions and answers pdf, mcq on Java pdf, Java questions and solutions, Java mcq Test , Interview Java questions, Java Questions for Interview, Java MCQ (Multiple Choice Questions),Core Java Questions, Core Java MCQ,core java interview questions for experiencedcore java interview questions for 3 years experience,java programming questions,core java interview questions for freshers,java interview questions and answers for freshers, java programming questions and answers pdf, java interview questions for beginners

1 Answer

0 votes
by
 
Best answer
The correct choice is (c) accessible within package and outside the package but through inheritance only To explain I would say: The protected access modifier is accessible within package and outside the package but only through inheritance. The protected access modifier can be used with data member, method and constructor. It cannot be applied in the class.

Related questions

0 votes
    Can a class be declared with a protected modifier. (a) True (b) False This question was posed to ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of the following modifier means a particular variable cannot be accessed within the package? (a) private ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these transfer protocol must be used so that URL can be accessed by URLConnection class object? (a ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Which one of the following is not an access modifier? (a) Public (b) Private (c) Protected (d) ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which is the modifier when there is none mentioned explicitly? (a) protected (b) private (c) public ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    What is true about protected constructor? (a) Protected constructor can be called directly (b) Protected ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    A class member declared protected becomes a member of subclass of which type? (a) public member (b) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    A class member declared protected becomes a member of subclass of which type? (a) public member (b) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    How many arguments can be passed to main()? (a) Infinite (b) Only 1 (c) System Dependent (d) ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these literals can be contained in float data type variable? (a) -1.7e+308 (b) -3.4e ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Which of these can be returned by the operator &? (a) Integer (b) Boolean (c) Character (d) ... java programming questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Which of the following can be operands of arithmetic operators? (a) Numeric (b) Boolean (c) Characters ... questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Modulus operator, %, can be applied to which of these? (a) Integers (b) Floating - point numbers ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 28, 2021 in Education by JackTerrance
0 votes
    Which of these can be overloaded? (a) Methods (b) Constructors (c) All of the mentioned (d) None ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Which of these method of String class can be used to test to strings for equality? (a) isequal() ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
...