testgreeting2.java

来自「java(sl275课程习题解module1-module3共7道习题的题目以及」· Java 代码 · 共 23 行

JAVA
23
字号
//
// Sample "Hello World" application
//
public class TestGreeting2 {
  public static void main(String[] args) {
    Greeting hello = new Greeting("Hello");
    hello.greet("World");
  }
}

// The Greeting class declaration.
public class Greeting {
  private String salutation;

  public Greeting(String s) {
    salutation = s;
  }
  
  public void greet(String whom) {
    System.out.println(salutation + " " + whom);
  }
}

⌨️ 快捷键说明

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