Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

About "final" and access modifiers order

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Im getting prepared for the OCA 8 exam, now with the "Practice Tests" book (Scott Selikoff and Jeanne Boyarsky). I found something that looks like a mistake in one of the solutions. Basically, the answer says that an access modifier must appear before the "final" modifier when declaring a variable in order to make the code compile. This is not true, as it is just a recommendation, but it's not compulsory as far as I know... right? I'm almost sure I'm not the first one noticing this, but I wanted to share it just in case. It is the question 36 from the Chapter 6 (page 91).
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch Naz.

You appear to be correct as demonstrated with the following code:

While both work, I would stick with only using one of them and I suspect that the convention is access modifier before non access modifier.

By the way I know that there is an Errata as found here https://www.selikoff.net/jpt/ which may list this. I know that it does list some corrections.
 
Naz Harvat
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Pete. I suppose you are right, it should refer to the convention or recommendation, not the compilation of the code. Unfortunately, this error is not on the list you shared, but hopefully it will be added (this topic I created should work as a notification).
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome Naz.

Remember, when in doubt try it out yourself with a small program like I did. Doing this will help solidify the answer in your mind. Not only that, then you don't have to wait for a reply to validate the answer.

You can expect to see a sorts of formatting and rearranging of the variable and method declarations on the exam and it will be up to you to know if it works or not.

By the way, you may want to check out Enthuware. For a small price you can get over 500 exam like questions with explanations to each answer. Many people have used this to help become prepared for the exam as you can see if you search for Enthuware.
If you do get Enthuware, remember that the recommendation is to wait a day or more between all nine of the sample tests.
 
Naz Harvat
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the recommendations! I agree with you and I actually write the code and check if it works whenever I have these kind of doubts, but in this case I just wanted to inform about this mistake in the book.

And about Enthuware, I will definitely check it out! I will get it to practice a bit more depending on my mark in the OCA simulation exam from the practice tests book (I will do it in 1/2 days).
 
Naz Harvat
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got 81.25% in the simulation exam. Taking into account this and the fact I did my preparation using this book (Practice Tests) but not the study guide, would you recommend me to take the oficial exam or to get a bit more prepared? The main problem for me is that I tend to get nervous so I don't detect basic code mistakes sometimes (like a "main" method without a static modified, for example). But I feel that I am prepared (meaning that my knowledge about the exam topics is more than enough) to take it.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried any of the Enthuware questions? They have a free trial with only about 20 questions. And the whole Enthuware question bank is only $10 USD for the 1z0-808 OCA exam. Which given that you hey over 500 questions is well worth the money. The more you practice the v mow relaxed you will be on the exam. Enthuware even times you when taking their tests so that will help you out as well.

All that said you may want to look at the OCA wall off fame https://coderanch.com/wiki/659980/Ocajp-Wall-Fame before you go off and write your test.

In the end, it is your call. Do you think that you are prepared? How is your time management on tests?
You can probably find other exam like questions on this site on via Google for free to see if your are able to answer them correctly.

Hope this helps,
Pete
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and I do not think that one practice test is enough...at least it was not enough for me but every one is different
 
Naz Harvat
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your advice. I decided to do also the tests from the "OCA study guide", to get more preparation.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note, that if you choose to take the same practice test more then once then you will most likely get artificially higher results.
This is because you will may remember answers to the questions.

As good as the resources are they only provide exam like questions and not actual questions, unless you choose the shady part of exam taking which is NOT recommended.
Yes, some of these questions may be really close to what is on the exam, and some may be really far off.

It's my understanding the exam centers have a question bank of more then a few hundred questions and come exam time you get a subset of questions from that master question bank.
Not only that the questions in the question bank could be recycled from exam to exam or replaced with new questions altogether.

These are just my thoughts and it may not be that helpful in the end,
Pete
 
    Bookmark Topic Watch Topic
  • New Topic