
a program in java to show that private mambers of a super class cannot be accessed from derived classes

class SuperClass
{
private int num=10;
private String st="Hello";
}
public class Subclass extends SuperClass{
public static void main(String[] args)
{
SuperClass cl=new SuperClass();
System.out.println(cl.num);
System.out.println(cl.st);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.