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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

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

Post by ETS User »

Seems like there's bug here:

"final Object[ ] objArr = { null } ;" should be right answer but answer key suggests otherwise.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

The question asks for the ones that are NOT valid.

HTH,
Paul.

jacob

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

Post by jacob »

the use of transient and volatile are not for OCA

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Objective 2.1 is "Declare and initialize variables"
So you should at least be aware of what these keywords do while declaring variables.

HTH,
Paul.

SirZed
Posts: 7
Joined: Sun Apr 07, 2013 9:45 am
Contact:

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

Post by SirZed »

native void format( ) ; seems to declare an abstract method, since the method body is missing, but there is also no abstract keyword. Is it legit in a class? If so, when and how?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

SirZed wrote:native void format( ) ; seems to declare an abstract method, since the method body is missing, but there is also no abstract keyword. Is it legit in a class? If so, when and how?
It is not an abstract method because there is no abstract keyword. It is a native method, that is why there is no method body. It means it is implemented by a native library and not in java code at that point.

-Paul.

SirZed
Posts: 7
Joined: Sun Apr 07, 2013 9:45 am
Contact:

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

Post by SirZed »

Okay, thanks!

fasty23
Posts: 37
Joined: Thu Feb 13, 2014 12:58 am
Contact:

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

Post by fasty23 »

Is the sequence of this option correct?
final transient static private double PI = 3.14159265358979323846

can we put private in 4th place?
are the access modifier, static and transient in same level?
Where can I find a document about declaring variable and method sequences?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Yes, it is valid. You can easily try it out :)
Please see this for all the details - http://docs.oracle.com/javase/specs/jls ... jls-3.html

fasty23
Posts: 37
Joined: Thu Feb 13, 2014 12:58 am
Contact:

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

Post by fasty23 »

the explanation mentioned:
Note: a class declaration can have only have final, abstract and public as
modifiers, unless it is a nested class, in which case, it can be declared private
or protected as well.
But we can have a class with no modifier (Default) too, Am I wrong?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Yes, you can have no modifier as well. The explanation is talking about valid modifiers only. default is default. It is not a valid modifier.

evaevaeva
Posts: 10
Joined: Fri Mar 06, 2020 5:18 am
Contact:

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

Post by evaevaeva »

Technically, the option 'abstract void format( ) ;' is also wrong, since if this method is in a class, the class has to be abstract too...

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

The problem statement doesn't say it has to be a concrete class. An abstract class is a class!

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests