Java Inheritance

CONSTRUCTOR WTH INHERITANCE :

class Student

{

int rno ;

int marks ;

int age ;

student ( )

{

rno = 0 ;

marks = 0;

age = 0 ;

}

pubic void display info ( )

{

system.out.println ( ''rno = '' + rno);

system.out.println ( ''rno = '' + rno);

system.out.println ( ''rno = '' + rno);

}

}

class City extends  Student

{

int fee ;

city ( )

{

super ( )  //parent class , super should be the 1st stat…….with in the const of city we have                // call the parent constructor

fee = 0;

}

display info ( )

{

simple.display.info

}

}

class Pr1

{

public static void main

city s1 = new city ( )

student s2 = new student ( )

s1.display info ( ) ;

s2.display info ( ) ;

}

Java has no char array but a string obj, there s no size of string ..

int a ;

string a ;

a = new sring ( ) ;

a = " abc "

f we write the header file import java.lang.*then we can write only string in above example but it will include the complete language folder so the prog will become slow that's y we can only write header file

import java.lang.string, but we don't have to import any thing which s n lang folder cuz it is included by default….

SUPER CLASS = means it have child classes e,g   java.lang.obj

SUBCLASS = s of 2 types

            final = can't be inherited

            none = no subclass s made