Discuss / Java / 作业

作业

Topic source

Best of Me

#1 Created at ... [Delete] [Delete and Lock User]

// TODO: 如果传入的参数为负,则抛出IllegalArgumentException

try {

if (salary < 0 || rate < 0) {

throw new IllegalArgumentException("警告,传入的参数为负!");

}

} catch (Exception e) {

// TODO: handle exception

System.out.println("-----------");

e.printStackTrace();

}

return salary * rate;

}


  • 1

Reply