ICSE Board Specimen 2014 : Computer Applications |
|
Constructor overloading is impemented when there are more than one functions in the same class having same name as that of class, each being differentiated by their argument lists.
Example:
class salary
{
int s;String name;
salary()
{
s=0;
name="";
}
salary(int a,String p)
{
s=a;
n=p;
}
salary(int t)
{
System.out.println("Tax = " +(s*t/100));
}
void main()
{
salary ob=new salary();
ob.salary(50000,"Asif");
ob.salary(33);
}
}
avina_maurya
|
ICSE Board Specimen 2014 : Computer Applications |
|
if-else-if |
switch-case |
It can work on int,short,byte,String, char, float, double. |
It can work only on int, char and long, |
It can have more than one conditions |
It has only one condition,i.e.,equality to the value passed in switch. |
avina_maurya
|
ICSE Board Specimen 2014 : Computer Applications |
|
Linear search |
Binary Search |
It can work both on sorted and unsorted array. |
It can work only on sorted array. |
It works bychecking all the elements of the array. |
It works by dividing the arrray in two parts and only one is to be exected. |
It becomes tedious when the size of array becomes very large. |
It is convinient when the size of array is big. |
avina_maurya
|
|
|