Help coderanch get a
new server
by contributing to the fundraiser

Jared Folino

Greenhorn
+ Follow
since Apr 27, 2007
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 Jared Folino

I am using HFSJ and I am up to the security chapter. I have made a basic example but for some reason, I am not getting asked to authenticate the client.

Has anyone got any ideas why I am not asked for authentication when I got to http://localhost:8080/auth/go.do? The security constraints don't affect this I am pretty sure of. Is their some sort of configuration in tomcat that needs to be done?

Tomcat-users.xml




Enthuware SCJP Test Studio
16 years ago
Well I finally did. My score was a little bit dissapointing, but hey I still passed easily. My scores for the sections were as follows:

Declarations %91
Flow Control %81
API Contents %60
Concurreny %62
OO Concepts %50
Collections %70
Fundamentals %100


I prepared with the K&B book, Enthuware SCJP 5 and Whizlabs. I highly recommend Enthuware. Their test simulator is very close to the real exam and it is much cheaper than Whizlabs. You also get a total of 11 tests as opposed to 6. My average for all 11 Enthuware exams was about %72.

Another point that I must mention is the master exams. They are harder than the real exam. They have a crappy interface and are tough because they don't tell you how correct answers their are. I only got %54 and %58 on them but I passed the real exam with a fairly decent score.

Thanks to Bert Bates and Kathy Sierra for a great book. Javaranch is great too. Also thanks to Enthuware for a test simulator that is fantastic. Finally to all of those preparing for the exam my advice is to stay positive and don't get discouraged. I only got %33 on the first Whizlabs exam. Just keep at it and you will do it.
16 years ago
Just got back from the exam. I passed with %75.
16 years ago
Thanks to everyone for their support. Pass or fail I will be letting everyone know how I go.
16 years ago
Hi Ranchers,

I am finally taking the SCJP 5 exam tomorrow. Wish me luck. I have prepared using Whizlabs and Enthuware. Both were pretty good. My Enthuware scores ranged from about %67 up to %82.

On a side note, is anyone preparing for the SCJP 5.0 from Australia? Doesn't really seem very popular here despite the countless jobs for Java at the moment.
16 years ago
Intialisation Blocks and instance variables are ALWAYS run before the constructor. But what you need to understand is the order in which they execute. This is one of the few places were Java actually works in a (slightly) structured way. It executes initialition blocks and instance variables in the order they appear in the class.

Just to further elaborate on what has already been discussed:

System.out.println("String".toUpperCase() == "STRING"); // returns false

This will return false using the == operator. Basically the toUpperCase (or any String method) will create a new object in the string pool. So think of string methods as the equivalent of using the new String("String") constructor.

However, their are 2 exceptions to this rule (Don't you just love the complexities of Java, come on it's sooo much better than PHP). The first is when the intern() method is used. basically intern() condenses the string pool and unite all strings so that they are the same object. Good for memory management.

System.out.println("String".toUpperCase().intern() == "STRING"); //returns true

The next is when the method makes no changes to the string. In this case true is also returned.

System.out.println("STRING".toUpperCase().intern() == "STRING"); // returns true
It might be a bit clearer as well if you remember that s.z is shortcut syntax. The full statement would be SpecialSerial.z
Static blocks cannot access instance variables. Stop and think about it for a second. If their are 7 instances of the class, which instance would it access, umm, arrr, yeah, as such remember it like this

static{}
can only call static methods and access static variables

{} //Initialisation block
can access static methods, static variables, instance variable (this) and instance methods (this)
A good accronym is
farms
nneed
big
red
tractors
Just remember that it is only for wrappers between -128 and 127
Actually here is a less confusing example. But before you scream because I am using a string in the for loop, stop for a second and think about it. The first statement can be any initialisation, the second can be any statement that evaluates to a boolean and the third can be any statement:



The output is:

B
BAB
BABAB

1. Firstly the an empty string is created. This satement is only ever executed once. The only time it can be executed more than once is when it is nested in another loop.

2. Next the sting (which is "") is compared to the string "BABABA" which returns false and is then inverted to true with !.

3. Now the last statement is executed in the for loop which makes the string equal "BA".

Repeat this 3 times and the for loop is finished. The moral of this example: is that you must know the order in which the for statement parts are executed.



1. Basically the init statement is executed once at the start. That's it. Not twice or three times and always at the start.

2.1 The boolean expression is evaluated.
if (boolean is true) then execute the statements
else FINISH for loop

2.2 Execute statement 1. This is the confusing bit. Logically you would think that the statement in the for loop would execute first, but it doesn't.

2.3 Execute statement 2.

3 Continue with step 2.1 until the loop is FINISHED


Hope this helps
Hey Kishore,

Don't worry too much, I think a lot of people are in the same situation. Here's a bit of a starter. Look at the following code:



Notice how i is pre-incremented in the the boolean expression in 'Flow Control 1' but i is pre-incremented in the end expression in 'Flow Control 2'. What you need to ask yourself is if this makes any difference to the end result? PM if you have any doubts.
Hey I am using Whizlabs as well. Pretty good overall. It helps you get used to the format of the exam and the questions are fairly though. I'm not sure if Whizlabs claims of it being harder then the real exam are true though? But still pretty good overall.