Constructor is static or non static

后端 未结 11 1535
青春惊慌失措
青春惊慌失措 2021-02-04 12:33

As per standard book constructor is a special type of function which is used to initialize objects.As constructor is defined as a function and inside class function can have on

相关标签:
11条回答
  • 2021-02-04 13:11

    Not static. Read about constructors http://www.javaworld.com/jw-10-2000/jw-1013-constructors.html.

    0 讨论(0)
  • 2021-02-04 13:12

    Constructors are non-static. Every method first parameter is implicit this (except static) and constructor is one of that.

    0 讨论(0)
  • 2021-02-04 13:16

    When we talk about static class then it comes to our mind that methods are called with class name,But in case of constructor ,Constructor is initialized when object is created So this proves to be non-static.

    0 讨论(0)
  • 2021-02-04 13:22

    Constructors are NOT static functions. When you do Test test =new Test(); a new Test object is created and then the constructor is called on that object (I mean this points to the newly created object).

    0 讨论(0)
  • 2021-02-04 13:23

    Constructors are neither static (as called using class name) or non-static as executed while creating an object.

    0 讨论(0)
提交回复
热议问题