根据标准书籍,构造函数是一种特殊类型的函数,用于初始化对象。由于构造函数被定义为函数,并且在类内部函数只有两种类型,即静态或非静态。我的疑问是什么是构造函数?
1.)As constructor is called without object so it must be static
Test test =new Test();//Test() is being called without object
so must be static
我的疑问是,如果构造函数是静态方法,那么我们如何在构造函数内部频繁使用“this”关键字?
Test(){
System.out.println(this);
}
输出 Test@12aw212
是不是意味着构造函数非静态?