Can constructor be final......? No constructors can't be final because it prevents to create an object of the class. Due to you can't change the parameters of the constructor once initialize. Ex. public class Main { final Main(){ System.out.println(' Can Constructor be final...?' ); } public static void main(String[] args) { System.out.println(' Compile Time Error.' ); } } O/P Main.java:11: error: modifier final not allowed here final Main(){ ^ 1 error Can constructor be private......? Constructors, like regular methods, can also be declared as private. You may wonder why we need a private constructor since it is only accessible from its own class. When a class needs to prevent the caller from creating objects. Private constructors are suitable. - Study24x7
Social learning Network
86 followers study24x7 22 Nov 2019 04:35 PM study24x7 study24x7

Can constructor be final......? No constructors can't be final because it prevents to create an object of the class. Due to you can't change the parameters of the constructor once initialize. Ex. public class Main { final Main(){ System.out.println(" Can Construc...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles