Write a method header on line two with the following specs:
Returns: an integer
Name: addTwo
Parameters:
-
An integer called "x"
-
An integer called "y"
You should not be writing code on any line other than #2
1
2
3
4
5
6
7
8
9
10
11
12
|
class Main {
public static int addTwo(int x,int y){
return x+y;
}
//test case below (dont change):
public static void main(String[] args){
System.out.println(addTwo(3,4)); //should be 7
}
}
|
반응형
'Java_beginner(Repl.it) > Auto-Graded-Course(AP CS A)' 카테고리의 다른 글
041 - Method Header Practice 6 (0) | 2019.12.19 |
---|---|
040 - Method Header Practice 5 (0) | 2019.12.19 |
038 - Method Header Practice 3 (0) | 2019.12.10 |
036 - Method Header Practice 1,2 (0) | 2019.12.10 |
035 - Sum Odds in Range (0) | 2019.12.10 |