Please Find Screenshot in which, this line initalting this class,
and then again, this line executing and repeating same process over and over again..
So solution is to do this by following way :
public class Test1 {
public Test1(int val) {
System.out.println(val);
}
}
public class Test {
int n = 10; // this will initiate this number by 10
public Test(int n) {
new Test1(n);
}
public static void main(String[] args) {
new Test(5);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…