classwithmethods.java

来自「c21Examples.rar」· Java 代码 · 共 27 行

JAVA
27
字号
import java.lang.String;

public class ClassWithMethods {

    public void displayText(String message, boolean newline) {
    // Displays message on the console, moving to
    // the start of a new line after message only
    // if newline is true.
    if (newline)
        System.out.println(message);
    else
        System.out.print(message);
    }

    public double halfOf(double value) {
    // Returns half of its argument.
    return value / 2;
    }

    public long sumOf(long value1, long value2) {
    // Returns the sum of its arguments.
    long result;
    result = value1 + value2;
    return result;
    }
}

⌨️ 快捷键说明

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