Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Aryaan Rajvansh

+ Follow
since Jan 27, 2006
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 Aryaan Rajvansh

Hi vinay !!!

public class test {
static int c;
public static void main(String args[]){
int a=10;
int b=5;
String d;
System.out.println(a + b + c); // it gives 15
System.out.println("" +a + b + c); // it gives 1050
System.out.println(a + b + c +""); // it gives 15


Lets take the output one by one.
In line one sop a,b,c are just integers ( Remember c is an instance variable so it gets a default value of 0) Hence no problem, its integer addition of a,b,c. Hence the result is 15.

In line two sop, Notice that "" is put before a+b+c.Since operation is performed from left to right the + operator is actually overloaded here as the first operand is a string " ",So it converts the other integers also to strings and uses + operator to just concatenate. Hence the result.

In line three sop, Notice that " " is after the addtion of a,b,c. Hence First the integer addition is performed and then when a string is encountered + gets overloaded and String concatenation takes place.

I hope that should solve your doubt. If not please feel free to get back to me.

Take care,
Hi satya !!

Thanks a lot and let me first apologise for not replying early....
Coming to your questions I had not studied Khalid Mughal.I had just studied Kathy Sierra as I found it more easy to understand and to the point.Khalid Mughal is no doubt a good book but i feel it is good for understanding the concepts in Java( I had tried reading from it).

I had studied K&B book nearly 3-4 times completely.I had done everything very systematically and i made it a point to stick to my plan. Probably that helped me in getting certified in just one month of preparation time.
One advise if you are following K&B is do the 2 mins drill before taking up the tests at the end of each chapter.

In general your confidence level will increase if you take more of mock exams after completing your study.Dont get discouraged if you get less score initially as it happens to all of us.I had got 59% in one of the mock exams initially...but its all a process of learning from your mistakes..
Wishing you luck for your preparation!!
Dear Sethi !!
Sorry for the delay in replying....
I dont know if K&B book is available on net for free or not but one thing I can tell you is that its an excellent book.Well I have the book in pdf formatwhich i had done for my personal use.


If you are following Khalid Mughal also no problem.Its also a very good book.Actually it is not about which book you read from rather it is to what depth you grasp the concepts.
Regarding purchasing the simulators..I had not bought any. I always used the free mock exams available on net and i think they were good enough.But if you are willing to spend then may be you should purchase Whizlabs simulator as I have heard very good about it and I also tried the trial version which was free..
I think that should clear all your doubts..But if you still have any doubts please feel free to ask me. You can also mail me at my personal id
Wishing you good luck!!
[ February 02, 2006: Message edited by: Bert Bates ]
Hi all !!

I cleared the SCJP 1.4 exam today with 80%. I found some of the question wordings a bit ambiguous. Anyways.. as the trend is Here is how i had prepared for the exam.
I started preparing for the exam exactly one month back and at that time I just had K&B book with me..I really think its a great book and I am thankful to the authors for writing such a wonderful book.Infact I didnot study any other book other than K&B.

After grasping the basics i took many online exams that are available for free on net.
some of them were from and Marcus Green set of question papers.
I wish all the best to all aspiring to get SCJP certified.
Hi Swathi !!!

sometime back i had a similar doubt with a question.To answer your doubt i am putting my question, its answer and the explaination. Hope you would be yourself able to understand the analogy.But if you dont..feel free to ask me again..

class GFC218 {
static void m(Object x) {System.out.print("Object");}
static void m(String x) {System.out.print("String");}
public static void main(String[] args) {

What is the result of attempting to compile and run the program?
a. Prints: Object
b. Prints: String
c. Compile-time error
d. Run-time error
e. None of the above

Answer is b Prints String and here is the explaination.

A method invocation conversion can widen an argument
of type String to match a method parameter of type Object,
so any argument that can be passed to m(String x) without generating
a compile-time type error can also be passed to m(Object x).
For that reason, we can say that m(String x) is more specific than m(Object x).
The argument of the method invocation expression, m(null),
is of type null and can be converted to either type String or Object by
method invocation conversion, so both methods, m(String x) and m(Object x),
are applicable. The more specific of the two, m(String x), is chosen over the
less specific, m(Object x).

I think that should solve your doubt.