代码实例:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package
com;
public
class
Test {
/**
* 数字相加
* @param a 形式参数
* @param b 形式参数
* @return 返回int 这个结果是a+b
*/
public
static
int
add(
int
a,
int
b){
int
c = a+b;
//执行语句
toString(a,b);
return
c;
}
public
static
void
toString(
int
a,
int
b){
System.out.println(
"长:"
+a);
System.out.println(
"宽:"
+b);
}
public
static
void
main(String[] args) {
//实际参数
int
x =
12
;
int
y =
34
;
int
sum = Test.add(x, y);
System.out.println(
"和:"
+sum);
/*
Test.toString(12,12);
*/
}
}
|
版权声明:原创作品,如需转载,请注明出处。否则将追究法律责任
本文转自 l363130002 51CTO博客,原文链接:http://blog.51cto.com/liuyj/1655857
