Pls tell me the output for the following code............

public class Test {

public static void main(String args[]){

int i=0;

for(int j=0;j<=10;j++) {


System.out.println("value of i\t"+i);

value of i is 0(zero), because
1. the assingment to variable i has no effect.
2. i++ itself increment the value of i by one,
and againg u are trying to assing i=i++, which is no
meaning(or effect).
3. replace i=i++; with i++; it will work now.


Edit: Browser error.

why not just run it and see what happens?
Whatever happened to showing even the tiniest bit of effort and initiative?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.