Read more: http://cheater-handal.blogspot.com/2011/05/cara-membuat-ucapan-selamat-tinggal-di.html#ixzz2VzHob9hY Contoh Program Java (Past By Value) | NOTE FOR LIFE

Contoh Program Java (Past By Value)

Listing 1
public class cobatestbyvalue {
    public static void main(String[] args) {
                int i = 21;
                System.out.println(i);
                        test(i);
                        System.out.println(i);
                    }
                    public static void test(int j){
                        j = 32;
                    }

                }
Output 1

Listing 2
public class cobatestbyvalue {
    public static void main(String[] args) {
                int i = 24;
                System.out.println(i);
                        test(i);
                        System.out.println(i);
                    }
                    public static void test(int j){
                        j = 36;
                    }
                }
Output 2

0 komentar:

Posting Komentar