Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Anjali Vaidya

Ranch Hand
+ Follow
since Jan 25, 2011
Anjali likes ...
Netbeans IDE Chrome Java
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 Anjali Vaidya

Thanks. Hope to give the exam before the objectives of Serialization are back on the exam!
I have gone through earlier forums where it says serialization is not asked in SCJP 1.6
But, as far as I have read, it is called exam objective 3.3

I have just 2 questions:
1. Is there any question in SCJP 1.6 on this topic?
2. If it isn't, can this topic be skipped for studying? Because, am finding this highly confusing Or do i have to study it IN CASE it is a foundation to understand any other topics in the future chapters?

Please help!
Let us take an example when you want to use methods of another class but its constructor is private so that you cannot create an object. In that case, make the specific method which you want to use anyhow, as static

So basically, you can use static if you want to access any method or variables without creating object of the class.
You can also use static block

static blocks are executed before main(). So you can write statements here too. For example: giving some instructions to the user before he enters some value

please point me out where exactly, byte is implicitly cast to int my example

byte is not implicitly cast into int in the switch statement. So this will give a compilation error if not cast into byte possible loss of precision
found : int
required: byte
case 128:
1 error

Is it that the program would have run fine if instead of Integer we had int as instance variable?

yes! it runs fine if you use int because instance variables of type "int" are given 0 as their default value.
Thanks Benjamin! I had forgotten that instance variables aren't overrided
why doesn't it print "Super" then?
Can anybody please write the line number it goes to step by step?

Is not the reference to the literal "hi" assigned to the args[0] from the command line?

The "hi" which is in the if condition is created in String pool but... The args[0] "hi" is created inside the String array args, which is on the heap.
You can write the method as:

10 years ago
Good question! These type of questions are always there in the exam to trick us

equals() compares the object values and is case-sensitive
== compares the object references i.e. if they share same address in memory which in this case is false
Hi Sudhanshu!

Eight objects before the println statement(that's the original question in book):
1.spring (stored in s1)
3.spring summer(stored in s2)
5.spring fall(due to result of s1.concat("fall") but not stored anywhere, so lost)
6.spring summer spring(due to result of s2.concat(s1) but not stored anywhere, so lost)
8.spring winter(stored in s1. at this point, "spring" attached to s1 is lost)

so finally, only two are stored, all others are lost. Including println statement, there are 10 String objects
9." "
10.The entire println you are printing to screen i.e. spring winter spring summer
Thanks Lou! I'm clear with the concept now
10 years ago
Hi! could anybody please tell me what is the difference between equals() and == ?
if possible with an example
10 years ago
Thanks a lot! It compiled I had stored it on desktop for trial purposes
if i was standing in the wrong folder, it wouldn't have compiled. It is not giving any compilation error
It is placed on desktop of both computers