can we declare private class in java file?

Answer Posted / honey

main class can not be make private in java ,only the nested class can be make privateand it can be assessable only in the main class not access by any other class in the package.

Is This Answer Correct ?    13 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is thread pool? How can we create thread pool in java?

865


In java, how many ways you can take input from the console?

774


How will you print number in reverse (descending) order in BST.

796


What are the differences between forwarding () method and sendredirect() methods?

864


What is used of static keyword in java?

813


Define a java class.

1122


What is the difference between preparedstatement and statement in java?

840


Explain the protected field modifier?

857


Does treeset allow null in java?

742


Can a static class have a constructor?

792


What are the pillars of java?

707


Why do I need to declare the type of a variable in java?

807


Why is singleton instance static?

770


Why set is used in java?

793


How can constructor chaining be done by using the super keyword?

891