How to make a public class not to be initialised by other classes *
*Making class as private
*Converting class to an interface
*Creating private constructor for the class
*Converting class to an abstract class
Answers
Answered by
2
Answer:
According to me the Making class as private is the correct answer.
If you are talking about coding java then idk.
Mark me as brainliest.
hope it helps.
Answered by
0
Converting class to an abstract class to make a public class not to be initialized by other classes.
How to Converting class to an abstract class :
- Declare the class as public so that objects outside of the current package can use it. By default, a class should only be used by other classes in the same package in which it was declared.
- If you don't wish to build a class, use the "abstract" modifier. javax servlet. In java, the abstract class HttpServlet is declared (despite the fact that none of its methods are abstract). Declare Object() as a no-argument private function.
Similar questions