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.
About Question enthuware.ocajp.i.v7.2.1056 :
Moderator: admin
-
- Posts: 2
- Joined: Thu May 08, 2014 11:37 am
- Contact:
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1056 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Thu May 08, 2014 11:37 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1056 :
Oh, thanks, forgot about thatadmin 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.
-
- Posts: 10
- Joined: Wed May 09, 2018 12:48 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1056 :
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 !
Thank you !
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1056 :
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();
}
native class X{
}
class Y{
native int a;
}
But following code will compile -
class Z{
native void m1();
}
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 46 guests