چند نکته در مورد Constructor در جاوا

  • Constructor is same as method without return type. It's job only an  initialization the instance variables with the default values.
  • Explicitly we can not call the constructor. JVM has to call the constructor.
  • Constructors name should be same as the class name.
  • The constructor can be created when the we create the object.
  • The constructor can be call only once per object.
  • Job of construction: set default value to class variables.
  • If we pass argument to constructor it is known as parameter constructor
  • We can create our java class without any constructor but a java class without constructor is not possible, because the java compiler adds the default constructor if a user has not mentioned any constructor
  • Note**: Java compiler adds default constructor nooooot JVM


نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد