Can a class be private or protected in java?



Can a class be private or protected in java?..

Answer / Ajay Kumar Pandit

In Java, you can define a class as private, but it can only be accessed within the same file. Protected classes cannot be declared.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

When is an object subject to garbage collection?

1 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

1 Answers  


Where is jre installed?

1 Answers  


What modifiers are allowed for methods in an interface?

1 Answers  


write java code to print second max number in the array

12 Answers   Huawei, IBAB,


Write code of any action class?

1 Answers  


Differences between traditional programming language and object oriented programming language?

1 Answers  


Why collection is called framework in java?

1 Answers  


How do you create a reference in java?

1 Answers  


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.

1 Answers   Manhattan,


What kind of variables a class can consist of?

1 Answers  


In a container there are 5 components. I want to display all the component names, how will you do that?

1 Answers  


Categories