JAVA方法
时间:2020-11-13 23:41:00
收藏:0
阅读:34
1. JAVA方法用于完成一段特定的逻辑和功能以便于被调用执行,定义在类或者对象中。
package com.langtao.method;
public class Demo1 {
public static void main(String[] args) {
int sum = 0;
sum = add(1,2);
System.out.println(sum);
}
public static int add(int a, int b){
return a + b;
}
}
原文:https://www.cnblogs.com/langtaoshuo/p/13971803.html
评论(0)