先写好结构:
包:com.公司名+项目名(项目名一般+Test/Demo)
Math的用法:
Math.floor():向下取最近整数;
Math.ceil():向上取最近的整数;
Math.round():Math.floor(a+0.5);
取随机数两种方法:
①:Random ran = new Random();
int i = ran.nextInt(9);——>变量值在0到9之间,左闭右开;
②:double + 变量 = Math.random();—>变量值在0到1之间;
Debug(可以跟踪变量,查看变量的变化,找到错误原因):
点击左边行数出现红点(打断点)后,摁住shift+alt+D进行Debug运行,摁住f5进入当前方法,摁住f6进行下一行方代码,f7退出当前方法.