what is the use of declaring constructor as private?

Answer Posted / ranganathkini

By making all the constructors of a class private, you can
also prevent other class from extending the class without
marking the class final.

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to reverse a string in java?

513


Can an interface extend another interface?

587


How to find the largest value from the given array.

514


How do you remove all elements from an arraylist in java?

497


What does += mean coding?

502






Tell me the Importent classes in net package?

1576


What is complexity in java?

511


What should I import for arraylist in java?

500


What is stack example?

537


What is a char in java?

524


Does java have extension methods?

516


What is singleton math?

566


What are scalar data types?

515


Can a static method be final?

543


Why java is said to be pass-by-value ?

532