0

why we use constructor?

9th Sep 2016, 2:28 PM
Ashok
Ashok - avatar
5 Answers
+ 1
A class is basically a blueprint to create an object. To actually use a class, you have to create an object of that class first (instanciation), and for that you define a constructor setting the values of the attributes of the object. Static methods can be used without needing an object.
9th Sep 2016, 2:35 PM
Zen
Zen - avatar
0
give me any example plzz
9th Sep 2016, 2:41 PM
Ashok
Ashok - avatar
0
give me any example
9th Sep 2016, 2:42 PM
Ashok
Ashok - avatar
0
constructor are use in java for only initialization it just like a bucket for variable were these are defined
9th Sep 2016, 3:32 PM
sachin yadav
sachin yadav - avatar
0
ha k thqq brother
9th Sep 2016, 3:32 PM
Ashok
Ashok - avatar