3
Most read
//Ques. 13

WAP on method overriding .

class wallet
{
double dim1,dim2;
wallet(double a, double b)
{
dim1=a;
dim2=b;
}
double salary()
{
System.out.print("n Income for Lifetime is Not Calculated = ");
return 0;
}
}
class monthly extends wallet
{
monthly(double a, double b)
{
super(a,b);
}
double salary()
{
System.out.print("n Monthly income is = ");
return dim1*dim2;
}
}
class annual extends wallet
{
annual(double a, double b)
{
super(a,b);
}
double salary()
{
System.out.print("n Annual income is = ");
return dim1*dim2;
}
}
class salary
{
public static void main(String arr[])
{
wallet d = new wallet(10,10);
monthly m = new monthly(330,30);
annual a = new annual(10000,12);
walletuv;
uv = m;
System.out.print(+uv.salary());
uv = a;
System.out.print(+uv.salary());
uv = d;
System.out.print(+uv.salary()+"n");
}
}
OUTPUT:-

More Related Content

PPTX
DOCX
Program persamaan kuadrat
PPTX
Closures
RTF
PDF
DOC
Sinusoidal graphs example
PDF
28. distance formulatemplatetouchpad
PPTX
Program persamaan kuadrat
Closures
Sinusoidal graphs example
28. distance formulatemplatetouchpad

Viewers also liked (20)

PPT
Method overriding
PPTX
encapsulation, inheritance, overriding, overloading
PPTX
2CPP12 - Method Overriding
PPTX
2CPP08 - Overloading and Overriding
PPTX
Overloading in java
PPTX
Method overloading and constructor overloading in java
PPTX
Polymorphism
PDF
Overriding methods
PPT
Introduction to method overloading & method overriding in java hdm
PPT
Polymorphism in java, method overloading and method overriding
PPTX
Exception handling in Java
PPTX
Exception handling in Java
PPS
Interface
ODP
Exception Handling In Java
PDF
Java exception handling ppt
PPTX
Inheritance in JAVA PPT
PPT
Packages and interfaces
PPS
Java Exception handling
PPT
Java interfaces
Method overriding
encapsulation, inheritance, overriding, overloading
2CPP12 - Method Overriding
2CPP08 - Overloading and Overriding
Overloading in java
Method overloading and constructor overloading in java
Polymorphism
Overriding methods
Introduction to method overloading & method overriding in java hdm
Polymorphism in java, method overloading and method overriding
Exception handling in Java
Exception handling in Java
Interface
Exception Handling In Java
Java exception handling ppt
Inheritance in JAVA PPT
Packages and interfaces
Java Exception handling
Java interfaces
Ad

Similar to Method overriding in java (20)

PDF
JavaCro'14 - JCalc Calculations in Java with open source API – Davor Sauer
PDF
C lab programs
PDF
C lab programs
PDF
Program.cs class Program { static void Main(string[] args).pdf
PPTX
Section1-Functiiiiiiiiiiiiiooooooooooooooooions.pptx
PDF
public class NegativeAmountException extends Exception {    .pdf
PDF
I need help creating a basic and simple Java program. Here is the ex.pdf
PDF
school-management-by-shivkamal-singh.pdf
PPTX
JCalc:Calculations in java with open source API
PDF
Interest.javaimport java.util.Scanner; public class Interest.pdf
PDF
The Effective Developer - Work Smarter, Not Harder
PDF
Java programI made this Account.java below. Using the attached cod.pdf
PDF
public class Interest{double interest(double rate, double amount){.pdf
PPTX
Functional JS+ ES6.pptx
DOC
Pads lab manual final
DOCX
program in c
PDF
Jak neopakovat kód, ale nepo**** abstrakci | Jiří Pudil | 15. 2. 2023 – Kiwi.com
PDF
C# Programming. Using methods to call results to display. The code i.pdf
JavaCro'14 - JCalc Calculations in Java with open source API – Davor Sauer
C lab programs
C lab programs
Program.cs class Program { static void Main(string[] args).pdf
Section1-Functiiiiiiiiiiiiiooooooooooooooooions.pptx
public class NegativeAmountException extends Exception {    .pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
school-management-by-shivkamal-singh.pdf
JCalc:Calculations in java with open source API
Interest.javaimport java.util.Scanner; public class Interest.pdf
The Effective Developer - Work Smarter, Not Harder
Java programI made this Account.java below. Using the attached cod.pdf
public class Interest{double interest(double rate, double amount){.pdf
Functional JS+ ES6.pptx
Pads lab manual final
program in c
Jak neopakovat kód, ale nepo**** abstrakci | Jiří Pudil | 15. 2. 2023 – Kiwi.com
C# Programming. Using methods to call results to display. The code i.pdf
Ad

More from One97 Communications Limited (20)

DOCX
Er. Model Of Hospital Management
DOCX
Fcfs Cpu Scheduling With Gantt Chart
PPTX
Neural Interfacing
PPT
Blue eye technology
PPTX
Computer Forensics
PPTX
Protect Folders without using any Software
PPTX
Introduction to Java Programming
DOCX
WAP to invoke constructors using super keyword in java
DOCX
WAP to find out whether the number is prime or not in java
DOCX
Overriding abstract in java
DOCX
How to achieve multiple inheritances by using interface in java
DOCX
WAP to implement inheritance and overloading methods in java
DOCX
program on Function overloading in java
DOCX
Program on usage of Final keyword in java
DOCX
WAP to initialize different objects with different values in java
Er. Model Of Hospital Management
Fcfs Cpu Scheduling With Gantt Chart
Neural Interfacing
Blue eye technology
Computer Forensics
Protect Folders without using any Software
Introduction to Java Programming
WAP to invoke constructors using super keyword in java
WAP to find out whether the number is prime or not in java
Overriding abstract in java
How to achieve multiple inheritances by using interface in java
WAP to implement inheritance and overloading methods in java
program on Function overloading in java
Program on usage of Final keyword in java
WAP to initialize different objects with different values in java

Recently uploaded (20)

PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PPTX
Diploma pharmaceutics notes..helps diploma students
PPTX
4. Diagnosis and treatment planning in RPD.pptx
PPT
hemostasis and its significance, physiology
PPTX
Climate Change and Its Global Impact.pptx
PPTX
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
PDF
Farming Based Livelihood Systems English Notes
PPTX
Neurology of Systemic disease all systems
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
African Communication Research: A review
PDF
Hospital Case Study .architecture design
PPTX
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
PDF
CAT 2024 VARC One - Shot Revision Marathon by Shabana.pptx.pdf
PPTX
Power Point PR B.Inggris 12 Ed. 2019.pptx
PDF
Compact First Student's Book Cambridge Official
PPTX
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
PPT
hsl powerpoint resource goyloveh feb 07.ppt
PPTX
UNIT_2-__LIPIDS[1].pptx.................
Everyday Spelling and Grammar by Kathi Wyldeck
Diploma pharmaceutics notes..helps diploma students
4. Diagnosis and treatment planning in RPD.pptx
hemostasis and its significance, physiology
Climate Change and Its Global Impact.pptx
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
Farming Based Livelihood Systems English Notes
Neurology of Systemic disease all systems
0520_Scheme_of_Work_(for_examination_from_2021).pdf
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
African Communication Research: A review
Hospital Case Study .architecture design
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
CAT 2024 VARC One - Shot Revision Marathon by Shabana.pptx.pdf
Power Point PR B.Inggris 12 Ed. 2019.pptx
Compact First Student's Book Cambridge Official
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
hsl powerpoint resource goyloveh feb 07.ppt
UNIT_2-__LIPIDS[1].pptx.................

Method overriding in java

  • 1. //Ques. 13 WAP on method overriding . class wallet { double dim1,dim2; wallet(double a, double b) { dim1=a; dim2=b; } double salary() { System.out.print("n Income for Lifetime is Not Calculated = "); return 0; } } class monthly extends wallet { monthly(double a, double b) { super(a,b); } double salary() { System.out.print("n Monthly income is = "); return dim1*dim2; } }
  • 2. class annual extends wallet { annual(double a, double b) { super(a,b); } double salary() { System.out.print("n Annual income is = "); return dim1*dim2; } } class salary { public static void main(String arr[]) { wallet d = new wallet(10,10); monthly m = new monthly(330,30); annual a = new annual(10000,12); walletuv; uv = m; System.out.print(+uv.salary()); uv = a; System.out.print(+uv.salary()); uv = d; System.out.print(+uv.salary()+"n"); } }