Shouldn't it be "default" - which differs from "protected"?(Note that the absence of access control keyword in the method declaration in a class means package protected.)
About Question enthuware.ocajp.i.v7.2.1150 :
Moderator: admin
-
- Posts: 1
- Joined: Fri May 01, 2015 7:48 am
- Contact:
About Question enthuware.ocajp.i.v7.2.1150 :
You wrote in comment to first answer:
-
- Site Admin
- Posts: 10382
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
Yes, it is default and it means "package protected", which is what the statement says as well.
-
- Posts: 4
- Joined: Sun Jan 08, 2017 12:27 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
Shouldn't 'public void compute();' be assumed to be an abstract method? and so should "void compute();"?
-
- Site Admin
- Posts: 10382
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
Yes, all non-static (and in Java 8, non-default) methods of an interface are abstract even if they are not explicitly declared to be so.bniky1 wrote:Shouldn't 'public void compute();' be assumed to be an abstract method? and so should "void compute();"?
HTH,
Paul.
-
- Posts: 202
- Joined: Mon Apr 02, 2018 8:40 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
I don't understand why the book OCA Oracle Certified Associate - Jeanne Boyarsky doesn't contain this sentence:
An interface can have a static method but the method must have a body in that case.
-
- Posts: 11
- Joined: Sat Dec 02, 2023 12:54 pm
- Contact:
-
- Site Admin
- Posts: 10382
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
There is no modifier named "package protected". This phrase is used just to explain the default accessibility. The default accessibility (which you get when you don't apply any modifier) is different from "protected" accessibility.
-
- Posts: 29
- Joined: Thu Aug 24, 2023 4:33 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
Hi,
I want to mention a small type.
The Fool interface spelled FooI, with and uppercase "i" not lowercase "L", in the code.
I want to mention a small type.
The Fool interface spelled FooI, with and uppercase "i" not lowercase "L", in the code.
-
- Posts: 29
- Joined: Thu Aug 24, 2023 4:33 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
Sorry now I noticed that it supposed to be FooI.
-
- Posts: 17
- Joined: Sat Jun 09, 2018 12:09 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
what about the answer:
with the explanation: "Here, no such subclass of MyClass exists and so this definition will not compile."
But the question is about the declaration, not the definition, so it doesn’t really meet the conditions stated in the question.
Code: Select all
sealed class MyClass { }
But the question is about the declaration, not the definition, so it doesn’t really meet the conditions stated in the question.
-
- Site Admin
- Posts: 10382
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1150 :
You are right. The statement "(Assume that there is no other member in the interface.)" has now been added in this option.
thank you for your feedback!
thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 76 guests