Why can't you declare a class as protected?



Why can't you declare a class as protected?..

Answer / Gaurav Kumar

In Core Java, classes cannot be declared with the 'protected' access modifier. Only methods and variables can be marked as protected.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is meant by event handling?

2 Answers  


What is canonical name in java?

1 Answers  


which of tha following is not a thread safe class? a) ArrayList b)Vector c)HashTable d)None

17 Answers  


What is use of map in java?

1 Answers  


What is this () in java?

1 Answers  


Why spring singleton is not thread safe?

1 Answers  


What is the difference between yield() and sleep()?

1 Answers  


How do you sort in descending order in java using collections sort?

1 Answers  


What is a lightweight component?

1 Answers  


What is super constructor?

1 Answers  


84. try { 85. ResourceConnection con = resourceFactory.getConnection(); 86. Results r = con.query(”GET INFO FROM CUSTOMER”); 87. info = r.getData(); 88. con.close(); 89. } catch (ResourceException re) { 90. errorLog.write(re.getMessage()); 91. } 92. return info; Which is true if a ResourceException is thrown on line 86? 1 Line 92 will not execute. 2 The connection will not be retrieved in line 85. 3 The resource connection will not be closed on line 88. 4 The enclosing method will throw an exception to its caller.

1 Answers  


Can a class be declared as protected?

1 Answers  


Categories