Access Control Using private Keyword - Java Quiz Question


What will be the output of the following program?

public class FoodItems {
    public static void main(String s[]) {
        Noodles eat = new Noodles();
        eat.print();
        Maggi mag = new Maggi();
        mag.print();
        System.out.println("~" + mag.sticks);
    }
}
class Maggi {
    private final int spoon = 3;
    protected int sticks = 4;
    void print() {
        System.out.print("~" + spoon);
    }
}
class Noodles extends Maggi {
    private final int powder = 1;
    protected int fire = 2;
    void print() {
        System.out.print(powder + "~" + fire + "~" + sticks);
    }
}


A
1~2~4~3~4
B
1~2~4~1~2~3~4
C
Compilation Error
D
Runtime Error