Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cetak {
- //Main Class
- static double maxNum(double a, double b){
- //method sama parameter berbeda
- //tipe data double
- if (a > b){
- return a;
- }
- else {
- return b;
- }
- }
- static int maxNum(int a ,int b){
- //method sama parameter berbeda
- //tipe data integer
- if (a > b ){
- return a;
- }
- else {
- return b;
- }
- }
- public static void main(String[] okedroid) { //method void main utama
- System.out.println (maxNum(9,20));
- System.out.println(maxNum(3.16,7.88));
- //hasil akan tampil sesuai dengan tipe data parameternya
- // 9,20 = tipe data integer
- // 3.16,7.88 = tipe data double
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment