Amrish Jhaveri

Greenhorn
+ Follow
since Dec 27, 2011
Amrish likes ...
Netbeans IDE Java Linux
Merit badge: grant badges
For More
Mumbai,India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
9
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amrish Jhaveri

I cleared OCJP 6 exam with 91%. The paper was too easy, really
11 years ago
Integer.toHexString(6); //will do the work!!
You must be lucky, no drag and drop!! I too heard the exam is easy then what we expect but how easy?? That i will come to know after giving the exam !!
12 years ago
Congratulations!!
Can you give some advice regarding preparation for the exam. I am giving on 11th August,2012!! I am almost done with the study guide and need lots of practice!!
12 years ago
The output is the number itself i.e 123456789 . The result doesn't change if using StringBuilder instead of StringBuffer.
@Aneek Banerjee:

I found the problem!! it is with i=i++!! You also found that it doesn't loop infinitely when you used i=++i.

I just tried this code to see what happens to the value of i:





The out was:

start
0
1
end

So as you can see when you do i=i++; it actually doesn't increment the value of i!!!(POST INCREMENT i.e first assign the current value to i, but NO INCREMENT is done)
But if you use i=++i i.e PRE INCREMENT , then it assigns the incremented value of 'current i' to i.


The reason for this is :

i++ means post increment. It means, the value will be incremented after the operation is performed on it. It doesnt mean, the statement will be completed before execution. That is the value of the variable 'i' will be stored in a temporary location, then the value is incremented and then, the actual operation is performed, in this case assignment, on the value in the temporary location.

Hence,

i = i++;

is equivalent to,

int temp = i; // temp = 0
i++; // i=1
i = temp; // i = 0

I found it on http://skeletoncoder.blogspot.in/2006/09/java-tutorials-i-i.html
Fees of OCJP 6 exam has changed from $300 to $150, right??
@Aneek Banerjee:



As far as the output of the above code is concerned it would be:

start
Starting1...
end

Do take note that you are using a unlabeled break, so it will come out of(break out of) the IMMEDIATE for loop(after executing just once).

There might be some problem with your java installation, re-install Java Development Kit.


@Seetharaman Venkatasamy :The difference between i++ and ++i is that it is post increment and pre-increment operators.For the given code i=i++ or i=++i wouldn't make a difference,since it breaks out of the for loop without checking the iteration expression!!!

To make it clearer for you, take a example:

int i=1;
int b=i++; // Assigning current value of i to b and THEN incrementing the value of i by 1.
int a=++i; // First increment the value of i by 1 and THEN assign it to a.

I scheduled my test of OCJP 6 for August 11,2012 using Pearson Vue. I got a email from Pearson Vue having two addresses(billing address and Shipping address).I guess PearsonVue doesn't send me any exam receipt or anything ??? and when i clear my exam my certificates will be delivered at the address mentioned in the account registered at oracle.com, right?? please help, my billing and shipping addresses are different!!!