Advertisement
tampurus

40 Initializing parent class variable super dikkat hai isme

May 9th, 2022 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.28 KB | None | 0 0
  1. class Parent {
  2.     int num;
  3. }
  4. class Child extends Parent{
  5.     super.num = 12;
  6.     void display(){
  7.         System.out.println("k="+ super.num);
  8.     }
  9. }
  10. class Main{
  11.     public static void main (String args[]){
  12.         Child obj = new Child();
  13.         obj.display();
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement