Unreachable Statement是什么意思

What is the meaning of Unreacheable Statement

它说 "int addition = t+r;" 是一个无法访问的语句。那是什么意思?如何纠正?

public class parseMETHOD {
       public static void main(String[] args) {
           int a=9;
           int b=45;
           int result=calFunction(a,b);
           System.out.println(result);
       }

       private static int calFunction(int t,int r) {
           throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools |
   Templates.
           int addition = t+r;
           return addition;

       } }

由于程序的某些控制,该语句在逻辑上不可访问 流动。您正在抛出未在您的函数中捕获的异常。

请删除throw语句和单词"Template"

   public class parseMETHOD {
       public static void main(String[] args) {
           int a=9;
           int b=45;
           int result=calFunction(a,b);
           System.out.println(result);
       }

       private static int calFunction(int t,int r) {

           int addition = t+r;
           return addition;

       }
   }

此外,良好的命名约定规定您应该将 class 个名称大写。