Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1056 :

Posted: Thu May 08, 2014 11:44 am
by jajcee
Can you specify in question that it is about top-level classes? Because in Leitner's mode when you can't see amount of correct answers you can answer "private class TestClass { }" as well as "final class TestClass { }".

Thank you.

Re: About Question enthuware.ocajp.i.v7.2.1056 :

Posted: Thu May 08, 2014 10:12 pm
by admin
private class TestClass { } is incorrect whether you are considering only top level classes or all classes because you can subclass a private class in the same parent class.

HTH,
Paul.

Re: About Question enthuware.ocajp.i.v7.2.1056 :

Posted: Mon May 12, 2014 5:15 am
by jajcee
admin wrote:private class TestClass { } is incorrect whether you are considering only top level classes or all classes because you can subclass a private class in the same parent class.

HTH,
Paul.
Oh, thanks, forgot about that :)

Re: About Question enthuware.ocajp.i.v7.2.1056 :

Posted: Sat May 12, 2018 1:14 pm
by mihhay
I am confused, what do you mean by : " The native keyword can only be used on methods, not on classes and or variables. " ?
Thank you !

Re: About Question enthuware.ocajp.i.v7.2.1056 :

Posted: Sat May 12, 2018 8:32 pm
by admin
It means you cannot define class or variable as native. So the following code will not compile -
native class X{

}
class Y{
native int a;
}

But following code will compile -
class Z{
native void m1();
}