I learn how data member of a class get there initial in Java..and how we can create object and function calling at class level | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I learn how data member of a class get there initial in Java..and how we can create object and function calling at class level

I will provide you three code... in a few min https://code.sololearn.com/c65Guq2attLc/?ref=app https://code.sololearn.com/ctTCtHLaEKTM/?ref=app https://code.sololearn.com/c9iPIuMPErjP/?ref=app pls correct me if i'm wrong.. I hope everyone help me to better understand

7th Apr 2018, 2:36 PM
Arun Tomar
Arun Tomar - avatar
1 Answer
+ 1
here the answere.. .. we must know that.. -->function can be called by function only... -->data member of a class get there initial value becoz of constructor. --> we declared data member at class level.. our compile.. do one thing.... i.e . ----->>> rewrite the data member.. inside the constructor... as we know that constructor is special member function of a class ..... i.e the only reason.. we can able to call function at class level.. and create object at class level.. becoz constructor rewrite the code inside in it... https://code.sololearn.com/c65Guq2attLc/?ref=app
7th Apr 2018, 2:45 PM
Arun Tomar
Arun Tomar - avatar