Created
August 29, 2019 18:29
-
-
Save cxubrix/ee11b383282748f793f0f55507c02288 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class MethodsExamples { | |
public static void main(String[] args) { | |
int x = getRandomNumber(); | |
helloKitty(); | |
hello("Kitty"); | |
hello("Student"); | |
hello("Teacher"); | |
int y = getRandomNumber(); | |
System.out.println("x: " + x); | |
System.out.println("y: " + y); | |
int avg = avg3(4, 39, 53); | |
System.out.println("avg: " + avg); | |
} | |
public static void helloKitty() { | |
hello("Kitty"); | |
} | |
public static void hello(String name) { | |
System.out.println("Hello " + name + "!!"); | |
} | |
public static int getRandomNumber() { | |
return new Random().nextInt(99); | |
} | |
public static int avg3(int a, int b, int c){ | |
int result = ((a + b + c) / 3) | |
return result ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment