带返回值的方法
This commit is contained in:
1 parent
b495294af3
commit
52b68a5706
2 files changed
+13
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package PACKAGE_NAME;public class Example21 {
|
||||
}
|
||||
Reference in new issue
Block a user