a)Example of Overloading int sum(int a,int b) float sum(float a,int b) float sum(int a ,float b) void sum(float a) int sum(int a) void sum(int a) |
//error conflict with the method int sum(int a)
b) Example: Overloading Class BookDetails{ String title; String publisher; float price; setBook(String title) { } setBook(String title, String publisher) { } setBook(String title, String publisher,float price){ }
} |
Example: Overriding class BookDetails{ String title; setBook(String title){ } } class ScienceBook extends BookDetails{ setBook(String title){} //overriding setBook(String title, String publisher,float price){ } //overloading }
|
Core Java Interview Questions
Object Oriented Programming(OOP) Questions and Answers
Collections Interview Questions
Java Exceptions Interview Questions
Java Threads Interview Questions
Collection framework in java interview questions
oops concepts with example in java
Java Serialization Interview Questions
Top 20 Core Java Interview Questions with Answers
String Interview Question in java With Example
synchronization interview questions
Java Reflection Interview question
Java Executor Framework (JDK 1.5) Interview Questions
JDK 1.7 interview Questations and Answers
Java I/O interview question with example