Bora Sabrioglu

Ranch Hand
+ Follow
since Nov 19, 2012
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 Bora Sabrioglu

Hey guys,

I got the scjp recently and now I want to tackle the scwcd exam.

I only know some veeeerrrry basic html...

I could work through head first html / xhtml / css book first, but maybe this would be too much of it and I have to hurry up a little...

so could I just go ahead and get the head first jsp / servlets book and start studying... and the html snippets are "self-explanatory" or easy enough that I could just understand them or just look it up if I dont know what it means...?

oh and how difficult is this exam compared to scjp?

and hey this my 100th post... gimme a cow already!

thanks for help
you're right... haven't thought about that... thanks.
7 years ago
Thanks Henry.

I think it works now. I extracted the A and B objects out of run and made them a member, so only one copy of them exists... and also influenced the order of object/lock access:

The output stops now.
7 years ago
Hi and welcome to the ranch!

I read HFJ... it's a good start for learning Java, entertaining... but keep in mind that it covers just the basics, it doesn't cover everything you need to know (like annotations, reflections, etc...).
You would have to continue your studies using other sources (like the oracle tutorials online for example, they're free and good, but not available in book form).

No clue about Android though, maybe there is some Android-specific literature out there that you may consult, that teaches you Java for Android.

Good luck!
7 years ago

fred rosenberger wrote:

does not compile. (since "strings and metacharacters don't mix too well".)
Thats why you need to escape them :
7 years ago
hmm. I inserted some s.o.p's and there continues to be some output:

I wonder if this is a deadlock or not... I guess not yet...
7 years ago
you're welcome.... just remember that metacharacters and strings don't mix too well... thats why you have to escape them twice (as in \\[)
7 years ago
I think I finally got it:

The 'this' reference was the missing piece of the puzzle...
I couldn't produce a deadlock, but now I have one
7 years ago
7 years ago

I'm trying to construct a deadlock deliberately by coding this scenario:

1) Thread A enters a synchronized method of object foo
2) Thread A goes to sleep (thus still holding the key of foo)
3) Thread B enters a synchronized method of object bar
4) Thread B tries to enter a synchronized method of foo (, but cant)
5) Thread A wakes up and tries to enter a synchronized method of bar => deadlock

I'm trying to keep the code really minimalistic, i.e. just 2 threads and 2 objects.
I also dont want to use this syntax:

but would like to achieve this just by calling synchronized methods of 2 different objects (as stated above).

I've been fumbling around for quite some time but I'm giving up now...

Help anyone?
7 years ago
k, found the error... the classpath has to be the current directory (.) in order for A to be found...
7 years ago
Hi guys,

I have following classes in the corresponding folders:

in C:\Users\me\Desktop\myJavaFolder


in C:\Users\me\Desktop\myJavaFolder\subFolder.

On the command line I made "C:\Users\me\Desktop" my current directory. Then on the command line I typed:

It compiled.

Then I tried to compile B as well and typed:

But it can't find A:

.\myJavaFolder\subFolder\ error: cannot find symbol
class B extends A{
symbol: class A
.\myJavaFolder\subFolder\ error: cannot find symbol
System.out.println(new B().i);
symbol: variable i
location: class B
2 errors

What am I doing wrong?
7 years ago
I was just wondering how it works in Java, since I read in HFJ about the "deadly diamond of death" in C++ and how Java goes about solving this. So I thought that if multiple inheritance in Java is forbidden for classes but allowed for interfaces, then what if one interface inherits from many interfaces and one class implements this interface... or as in the example above, implements multiple interfaces directly... then this would be a different form of the DDoD-problem I thought... but as you pointed out, the compiler stops one from doing this and there is no room for ambiguity.

I of course would not go about implementing such interfaces myself, but could imagine that both interfaces are from different external and independent sources... then there you would have one implementation for both interfaces.
7 years ago
Hey folks,

imagine you are implementing 2 interfaces having identical method signatures:

How can I implement both methods?

Or another example with member variables:

How can I go about making clear which 'i' is meant?

Thanks in advance.
7 years ago
just added it to my wishlist thanks
8 years ago