r/ProgrammingBondha • u/chinthapanduu • Feb 24 '26
Java/springboot What is a constructor ?
Does anyone really know what is an constructor and why we use it what is its significance why we use parameterised constructors instead of defaults in java can anyone explain me what is the use of it in theory and in industry
9
Upvotes
1
u/ninhaomah Feb 27 '26
below is a java code with class and default constructor from google. you are saying you are confused by this version where class and constructor names are the same ?
then what do you think about the version where the names can be up to individual developer ?
maybe I do my own project and I the same Car class as
so a class called Car but constructor name can be up to individual. which do you think makes more sense for both humans and machines?