Hello Ranchers
I am taking the exam tommorow and i have one query
My pc isnt working and so i cannot compile and see the behaviour of the following
java file
Please Help me out right now i have logged in from cyber cafe
Without wasting the time i am posting the question
[code]
//Test.java
package foo;
class
Test {
protected void methodA()
{
}
}
------------
//XYZ.java
package bar;
import package foo.*;
class XYZ extends Test
{
public static void main(
String ar[]){
XYZ obj=new XYZ();
obj.methodA();
}
}
what will be the output .
I guess The output would be a compile error
but its using the dot reference on the subclass so i am a bit messed up please clear guys
Thanks
[code]
One more Question
//Test.java
package foo;
class Test
{
char methodA()
{
}
}
======
//XYZ.java
package bar;
import foo.*;
class XYZ extends Test
{
public static void main(String ar[])
{
Test t=new Test();
t.methodA();
}
}
What is the output i guess again compile error because the methodA is having the default please just clarify thanks a lot
[code]
Edited title:like Bert wrote below (it may be urgent to you, but it is not to the majority) [ June 03, 2007: Message edited by: Barry Gaunt ]