Page 467 - Computer science 868 Class 12
P. 467
37 public static void main(int a[],int nn,int xx,int yy)
38 { ArrayD ob=new ArrayD(a);
39 System.out.println("The array is");
40 ob.display();
41
42 if(ob.searcharray(nn)) //base class method
43 System.out.println(nn+" is present in the array");
44 else
45 System.out.println(nn+" is not present in the array");
46
47 if(ob.searcharray(xx,yy)) //derived class method
48 System.out.println(xx+"< all elements of the array < "+yy);
49 else
50 System.out.println(" elements not in range");
51 }
52 }
The output of the preceding program is as follows:
12.3.1 Static Binding and Dynamic Binding
If the method is matched with the right method definition by the compiler at compile-time, it is called static binding.
The following points are to be noted in Java static binding.
• Methods and variables declared as private, final or static use static binding.
465
Inheritance, Interfaces and Polymorphism 465

