带返回值的方法

This commit is contained in:
seahi committed 2024-09-09 20:52:49 +08:00
1 parent b495294af3
commit 52b68a5706
2 files changed
+13

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
public class Example20 {
public static void main(String[] args) {
int area = getArea(3, 5);
System.out.println("The area is " + area);
}
public static int getArea(int x, int y) {
int temp = x * y;
return temp;
}
}
+2
View File
@@ -0,0 +1,2 @@
package PACKAGE_NAME;public class Example21 {
}