الرجوع
تسجيل الدخول

What is the output of the program?

public class Main {
    public static void main(String[] args) {
        Product.setBarcode(123456);
        Product prod1 = new Product();

        Product.setBarcode(987654);
        Product prod2 = new Product();

        System.out.println(prod1.getBarcode());
        System.out.println(prod2.getBarcode());
    }

    public class Product {
        public static int Barcode;

        public int getBarcode() {
            return Barcode;
        }

        public static void setBarcode(int value){
            Barcode = value;
        }
    }
}