Originally posted by Stefan Wagner:
Is there a line at the top, indicating for which shell it is written, like
#!/bin/bash
#!/bin/ksh
?
Did you remove some linebreaks?
Originally posted by peter cooke:
Since I took the beta version of the exam(before knowing anything about webservices), I feel that reading rmh book would have been more useful than either practice exam.
.
Originally posted by Kicky San:
From this thread and by the following example, I am jotting down my observations. Please correct me if i am wrong.![]()
1. static methods can be inherited
2. static methods can be called both by the class name and the class instance
3. static methods cant be overridden. static means one in a class.
4. Even if there is a static method in the child class same as the one in the parent class, it is not the overriden method. It is a seperate method of the child class.
Hope this example will clear all these points.
I have modified the previous example. Here is the modified version
class InheritStaticBase
{
public static void print()
{
System.out.println("I am in base class");
}
}
class InheritStaticChild extends InheritStaticBase
{
public static void print()
{
System.out.println("I am in child class");
}
}
class Main
{
public static void main(String args[])
{
System.out.println("using parent class name");
InheritStaticBase.print();
System.out.println("using child class name");
InheritStaticChild.print();
System.out.println("befre instantiating child class");
InheritStaticChild a = new InheritStaticChild();
a.print();
System.out.println("after instantiating child class");
System.out.println("befre instantiating parent class");
InheritStaticBase b = new InheritStaticBase();
b.print();
System.out.println("befre instantiating parent class");
}
}
Originally posted by Arvind Sampath:
2. Does the private method gets inherited to the sub classes ?
No. Private methods are private to the classes in which they are defined. They are not accessible anywhere outside.
3. If the private method is not overridden in the sub class, can we
invoke the private method of the Base class thru sub class object ?
ie sub.supA(); // is it allowed ?
No. Private methods are not inherited by a sub class. Hence, they cannot be overridden neither can they can be accessed using an object of the subclass. Infact, they cannot be accessed outside the class in which they are defined even by using the object of the corresponding class
![]()
Arvind[/QB]