multilevel inheritance

Multilevel, Hierarchical and Hybrid Inheritance

Multilevel, Hierarchical and Hybrid Inheritance Multi-Level Inheritance in Python #Multilevel Inheritance in Python class India: def first(self): print (‘India is the largest democratic country in the world’) class Karnataka(India): def sec(self): print (‘Karnataka is famous for IT and Coffee Production’) class Bengaluru(Karnataka): def third(self): print (‘Bengaluru also known as Garden city!’) b=Bengaluru() b.first() b.sec() b.third() […]

Share

Multilevel, Hierarchical and Hybrid Inheritance Read More »

Java Inheritance and packages

Java Program to display Student Marks information using Single Inheritance. import java.io.*; class Student { int rollno; String nm; } class Marks extends Student { int p, c, m, tot; Marks() { try { DataInputStream in=new DataInputStream(System.in); System.out.print(“Enter Roll No:”); rollno=Integer.parseInt(in.readLine()); System.out.print(“Enter Name:”); nm=in.readLine(); System.out.print(“Enter Phy Marks:”); p=Integer.parseInt(in.readLine()); System.out.print(“Enter Che Marks:”); c=Integer.parseInt(in.readLine()); System.out.print(“Enter Maths Marks:”);

Share

Java Inheritance and packages Read More »

Share
Scroll to Top