KaiquanMah commited on
Commit
a528ad9
·
verified ·
1 Parent(s): bc8f85a

Create 6a. Return value type, mandatory value

Browse files
Week 2: Methods, strings and lists/6a. Return value type, mandatory value ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ return value type - must be comatible with input args' type
2
+
3
+ public static double smaller(int a, int b) {
4
+ if (a < b) {
5
+ return a;
6
+ } else {
7
+ return b;
8
+ }
9
+ }
10
+
11
+
12
+
13
+ ==================================
14
+
15
+
16
+ Return value is mandatory
17
+ If a method is of a type other than void, it must return a value of the specified type.
18
+ The value must be returned in every case