ex_function.java.txt

来自「JAVA分布式程序学习的课件(全英文)」· 文本 代码 · 共 30 行

TXT
30
字号
/***********************************************************
   Java program sample to illustrate the use of a static 
   method in the role of a "C-style function"
   Author: M. Liu
   Date:   1/11/01
***********************************************************/
public class Ex_function {

   public static void main (String[] args) {

      // invoke a void function
      func1("hi!" );
     
      // invokde a value returning function
      System.out.println(func2());
   
    } // end main

    static void func1(String aString) {
       System.out.println("You said: " + aString);
    } // end func1

    static String func2( ) {
       return ("func2 called");
    } // end func2

} // end class

     

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?