From 34f183975c932fa762025d45c23927026f903a0c Mon Sep 17 00:00:00 2001 From: xuxin <840198532@qq.com> Date: Wed, 24 Dec 2025 11:58:03 +0800 Subject: [PATCH] =?UTF-8?q?14.=E6=96=B9=E6=B3=95=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89-=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day02/src/com/inmind/Demo12_Method.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/day02/src/com/inmind/Demo12_Method.java b/day02/src/com/inmind/Demo12_Method.java index a9236ab..6eeb9a7 100644 --- a/day02/src/com/inmind/Demo12_Method.java +++ b/day02/src/com/inmind/Demo12_Method.java @@ -24,10 +24,18 @@ public class Demo12_Method { public static void main(String[] args) { //调用加法功能的方法 addMethod(); + //调用减法的方法 + jfMethod(); } //需求:定义一个无参无返回值的,封装了三元运算符,判断i,j哪个变量小的结果,并打印sout,最后在主方法中调用 + public static void jfMethod() { + int a = 20; + int b = 30; + int result = a > b? b:a; + System.out.println(result); + } //类中方法外 //需求:将加法的功能封装成一个方法,随时调用