/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
public class Main
{
public static void main(String[] args) {
A a = new A();
B b = new B();
System.out.println("A:");
a.method();
System.out.println("B:");
b.method();
}
public static class A {
private void method() {
System.out.println("i am private");
}
}
public static class B extends A {
protected void method() {
System.out.println("i am overrided and i am protected");
}
}
}