Posts

Showing posts with the label Demo of Access specifier and Inheritance in Java
package scope; import java.util.Scanner; class person {private String name; int adharno; person() {     System.out.println("Base class constructor invoked");         } private    void getAdharno(int no,String s)     {         adharno=no;         name=s;     }    protected void getdata(int num,String s)     {       getAdharno(num,s);             }       void display()    {        System.out.println(adharno+"   "+name);    } } public class student extends person{     int rollno;     String year;     String branch;     student()     {super();      ...