60. 方法综合运用

👁️ 7 人浏览 💬 0 人评论 ❤️ 添加收藏

语法讲解

今天学: 多个方法可以互相配合完成任务。

public class Main {
    public static int square(int x) {
        return x * x;
    }

    public static int sumOfSquares(int a, int b) {
        return square(a) + square(b);
    }

    public static void main(String[] args) {
        System.out.println(sumOfSquares(3, 4));
    }
}

小练习

输出是什么?

提交要求: 只提交最终输出结果,不要添加多余的说明或引号。

提交你的答案
请登录后提交答案。
去登录
代码编辑器
Ctrl + Enter 运行
输入:
输出:

                        
👩‍🏫
AI
💬 题目评论

全部评论