创建带返回值的函数 访问控制符 [返回值类型] 方法名 (){ retrun[返回值] //void 没有返回值,可省略 } public int test(){ int a =10; int b=2; retrun a+b; }