luren

在catch块中throw new Exception的意义

throw new Exception(String, Exception)

throw new Exception(String)
throw
是明确地抛出异常
throw new Exception("自定义抛出错误的原因").

public doube Division(double a,double b)
{
  if(b==0)
   {
     throw new Exception("除数不能为0");
   }
 return a/b;
}

分类:

技术点:

相关文章:

  • 2022-02-27
  • 2022-03-08
  • 2021-11-21
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案