jay sugrue

Greenhorn
+ Follow
since May 29, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jay sugrue

Hi,
I'm currently preparing to take the SCJP exam and am finding a lot of mention of topics that are not tested in the exam. I've also heard - on this forum - that serialization - is not covered ? I'm not having much luck searching for it but is there anywhere that has a pretty definitive list as to what is NOT on the current exam. Thanks.

I guess you're right, thanks Henry.

Hi,

I'm going through the self test questions for chapter 10 in the Sierra-Bates SCJP guidebook and having serious difficulty. There isn't much point
posting the questions I'm having difficulty with because most have already been discussed on the forum already. I've read through these and still
can't make any headway. The questions are numbers 3,5,9,10,11,12 and they all involve the scenario 'given a directory structure, and a certain
current directory which java command will invoke the following output'...

The questions posted and discussed seem to me to have an almost contradictory logic that leaves me even more confused. So, what I'm looking for -
and have looked for to no avail - are notes etc. that explain to me - LIKE I WAS A FIVE YEAR OLD - classpaths, how to get to class files through directory structures.

Is there any instructional blogs, video tutorials, notes out there that explains all this clearly. Any links posted will be gladly appreciated.

Thanks.
The answer to this question also says that if c were marked static and because yack is synchronized then the answers would be:

C: The output could be 4 4 2 2

E: The output could be 2 2 4 4

Is this because c does get initialized in the go method and if it was a static variable (just one copy) then the invocation of yack would
now be on an initialized variable, no matter the instance used ?

Thanks Fred, Jeff. Yeah, Jeff, I think that would be an understatement at this point. Definitely better for a couple days break from it.
11 years ago
In the Sierra-Bates self test questions on Inner Classes (Chapter 8) there is this following question on which I seek some verification.



The answer given to this question is 21 not 15. I understand that class Gazer, as an inner class
has access to class Navel's private and static members. So when the go and then adder method's
are invoked and 'size' is returned it is the Navel's static 'size' which is 7. But before that doesn't the
go method reassign 'size' to 5 ?
Does it do this anyway but the adder method can only see the static 'size' (7) and not the method local
'size' (5) ?

PS. Will be without internet access probably until tomorrow afternoon - so won't be able to reply until then.
Thanks.
11 years ago
Cool. Thanks again Kemal.
11 years ago
Kemal, Jeff,

Yes, the last two continue statements have no active role in the code. so, given this, the outer loops are iterated through via the break statement ie.


At this point the inner loop is broken and the outer loop iterates to the next element. 1 changes over to 3. Yeah ?
11 years ago
Kemal,

Just looked again at your code solution - apologies for this but according to the answer given the last two continue statements are redundant. So, in this case is it the break statement that moves the outer loop onto next element ?
11 years ago
Yeah, this makes much more sense. Thanks Kemal for all your time and effort on this, I really appreciate it.

...and to hopefully wrap this up the continue below is why 5 and 7 are skipped ?


11 years ago

Hi,

In the Sierra-Bates self tests I'm having difficulty with this question, its q10 from chapter 5




My understanding of this code is as follows:

Inner loop first iteration
j = 0
x = 1 //1 is printed
break not executed

Inner loop second iteration
j = 1
x = 1 //1 again is printed

break condition resolves to true, break is executed so in the outer loop x is moved to next value = 3
So, at this point, does the break statement mean, as the next inner loop iteration is entered, the value of j is
still at 1 or is it now 2 ?

If j's value is indeed 2 and the inner loop iterates, x is printed as 3, and on the next iteration of the inner loop the
condition fails (j becomes 3) does the print statement still run ? Printing x as 3 again. If so giving us 1133 ?

I know it can't be 1 - would that not result in the next element of the outer loop ie. 5 when the answer is:

113399

Hope formatting is better than my last post ! There's a couple more questions on this but for now, thanks !


11 years ago
Thanks for the replies Campbell and Henry, I'll do that and Henry, yes, I see now what you mean about the formatting. Forgive me, this is what I've been looking at for a few months now and I've no previous experience in Java or any other programming language. I actually think it looks nice and neat that way, ha ! But yeah I'll format in future.
11 years ago
thanks everyone for your replies. Peter, it is that ocjp preparation book, i'm going through the self test questions and finding some very tricky so i hoped to get some help on the forum here. is it ok to put them up ? i have four/five more i'm having trouble with. ideally, is there a thread on which these questions have already been discussed ?
11 years ago


The result of this code is
-ic mc mf of

what i can't understand here is that the finally block runs twice - how is this ? I thought a finally code could only run once - is this because they are tied into nested try blocks ? is it that because one try block is nested it can run finally completely independent of the enclosing try block, so both finally blocks run ? or am i in the wrong ball park altogether ?

My thanks in advance.

PS Where i'm located over the next couple of days means at best i'll only have intermittent internet access, so forgive if an immediate reply isn't received (probably won't be able to get back online until 5/6 this afternoon/evening.
11 years ago
Thanks guys, and cheers Paul for that, plenty to go on there...will go back and have a closer look at it. Stay tuned, I may need ye again !
11 years ago