Wednesday, November 9, 2016

Before vacation


1.Bubble Sort
2. Different binding scenario with example.
3. Abstraction in java with example.
-------------------------------------------sapient

Note: in function overriding, when Parent method has return type int

1st condition
public class Parent{
public int add(int a, int b){
return a+b;
}
}

public class Children extends Parents{
public Number add(int a, int b){     ////////// We will get compile time error , we cant expend the return                                                            type , it will show error , reverse will work
return a+b;
}
}


what happens when parents class return int and child class returns string,
Ans : In that case , compiler will say duplicate method error

No comments:

Post a Comment

Required details

--------------------------------------------------------------------------------------------------------------------------- C:\Program File...