Thursday, August 13, 2020

super class private varibales can't access in child

 class Priva  //super class private varibales can't access in child

{

int a=10;

private int b=20;

}

class Use extends Priva //chlid

int c=20;

}

class Dri

{


public static void main(String[] args) 

{

Use p1=new Use();

System.out.println("public variable"+p1.a);

       System.out.println("private variable"+p1.b);

      System.out.println("private variable"+p1.c);

}

}


No comments:

Post a Comment