测试添加参数的效果代码:
java
package org.example;
public class Demo1 {
static int count = 0;
public static void main (String[] args) throws InterruptedException{
//为什么不写String[] args就不出现运行的标识呢?
method1();
try{
method();
}
catch (Error e){//这个是Error 用Exception无法捕捉
System.out.println(e);
System.out.println(count);
}
}
private static void method() {
count ++;
method();
// System.out.println(count);
}
private static void method1() {
method2(1,2);
}
private static int method2(int a, int b) {
int c = a + b;
return c;
}
}
添加方式如图,参数格式类似:-Xss1024k
![](https://i-blog.csdnimg.cn/direct/1265628aa20c42789ef61d3fb73ddd30.png)
![](https://i-blog.csdnimg.cn/direct/3613a514451b4bd3891bfd6726cdb2b8.png)
![](https://i-blog.csdnimg.cn/direct/3d24e62905504e0caa410f25b900b701.png)