Copyright ?版權微商網(wǎng)所有
微商網(wǎng)分類欄目:微商怎么做、微商貨源、微商怎么找客源、
在java的一個類中,可能含有多個構造函數(shù),如果其中的構造函數(shù)調用其他的構造函數(shù),不能直接寫構造函數(shù)名,應該用關鍵字this調用.
例如:
01.public class Test{
02. public Test(){
03. this(1);
04. }
05. public Test(int i){
06. System.out.println(i);
07. }
08.}