Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Maxitoxin Mayank

+ Follow
since Feb 07, 2018
Maxitoxin likes ...
Tomcat Server Java Linux
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maxitoxin Mayank

Thanks Ben, though to further clear my understanding, if we replace the statement with it will fail to compile in the current context, isn't it?
I am referring to Sybex OCP Study Guide for IZO-809 , Chapter 1 , Topic Inner Classes. Quoting some text from the below code's explanation "Line 15 uses the awkward syntax to instantiate a B. Notice the type is A.B. We could have written B as the type because that is available at the member level of B. Java knows where to look for it".  However as per my understanding we are accessing B from static method, and hence directly using B as reference type will not work as it is not a static inner class. Please let me  know if my understanding is correct

First of all I would like to thank

Jeannne Boyarsky


Scott Selikoff

for the OCA (Sybex) Study guide. I followed the book as base and referred to StackOverflow, Coderanch and JLS 8 to prepare for the OCA IZO808 exam. For practise I took Enthuware practise test package. I was able to secure 88% in the final OCA exam.

Now I want to prepare for the OCP exam and I have already purchased the Sybex OCP Study guide. I was wondering, whether for OCP exam will I need to refer to specific materials on various topics separately, or the Study guide would be sufficient. I have worked on spring framework for 2 years in the past , when I began my career. However now I am into a non technical role in my current work position. Hence I do not get much exposure to writing code in my work place itself.

As for the future, I intend to go for Java EE certifications as well , If I am done with the OCP certification with confidence in reasonable amount of time.

Any suggestions on how to proceed, or which materials to follow, or what kind of practise to be done, would be helpful and happily welcome.
After posing the question, i stumbled upon an already existing post on the same issue. So i suppose it is now answered.

The post is here for your reference.
Could you please let me know if my understanding is wrong here regarding the below 2 statements from the respective sources. The statements deal with default access specifier at class level.According to me they are not saying the same things.

Source 1 : OCA Oracle Certified associcate Java SE 8 Progammer 1 Study Guide  (Jeanne Boyarsky and Scott Selikoff) : Chapter 5 , Pg : 237

The default package private modifier , which is the lack of  any access modifier, indicates the class can be accessed only by a subclass or class within the same package.

Source 2 : Java docs ( )

If a class has no modifier (the default, also known as package-private), it is visible only within its own package

Am I comparing not equivalent things here ? If not, could you please explain how they are same.

Jeanne Boyarsky wrote:Welcome to CodeRanch! I added "Sybex" to your subject. In the future, please mention the publisher as a number of books have similar titles.

Thanks for the edit in my post and the answer

It is safe to assume that package statements (or imports) start a new file.

I was further searching on this and came up with the below explanation.
If all the statements above are in one file, it won't compile if the order is same. Import statements can not occur after a class declaration.
Correct me if I am wrong.

In above code, local variable y is in scope for the block of do while statement. This is valid for all the iterations of the loop. So why does java not throw an error "Variable Y is already defined" for subsequent iterations after the first one, as we are redeclaring the same variable in each iteration?
2 years ago
I was going through the book 'OCA Oracle Certified Associate Java SE 8 Programmer I Study Guide Exam 1Z0-808' for OCA preparation. In the review questions for 1st Chapter I have a confusion in understanding the way the question is presented.  I am posting the question below as it is. From the question I am unable to make out, whether all the classes mentioned here , are present in the same file or not. If we consider all of the classes to be in one java file, then the answer should be option F. But thats not the case, according to the answers given later.  Can someone help me understand where my understanding of question went wrong.

5. Given the following classes, which of the following can independently replace INSERT
IMPORTS HERE to make the code compile? (Choose all that apply)

A. import aquarium.*;
B. import aquarium.*.Jelly;
C. import aquarium.jellies.Jelly;
D. import aquarium.jellies.*;
E. import aquarium.jellies.Jelly.*;
F. None of these can make the code compile.