⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staticfuntest.java

📁 java程序设计 清华出版社 孙燮华老师编写的程序源代码
💻 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 + -