📄 staticfuntest.java
字号:
//StaticFunTest.java
class generalFunction{
public static int add(int x,int y){//静态方法
return x+y;
}
}
public class StaticFunTest{
public static void main(String[] args){
int c=generalFunction.add(7,8);//在对象产生之前用generalFunction类名调用方法
System.out.print("7 + 8 = " + c + ", ");
generalFunction fun=new generalFunction();
int d= fun.add(5,8); //用实例对象名fun.调用方法add()
System.out.println("5 + 8 = " + d);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -