Activity

  • kamal posted an update in the group Group logo of java Programmerjava Programmer 5 months, 2 weeks ago  · 

    What are some common beginner mistakes in Java programming?

    ou can’t use integer variables in an if condition :

    For C/C++ this is absolutely correct :

    int i = 0;
    if(i) //this results to a false condition in C++
    { //do something
    }

    However for java the above program will result in compiler error, instead you have to use boolean variables :

    boolean i = false;
    if(i)
    { //do something
    }

    Also java does not have a sequence point i.e.

    i = i++ + i++;

    is completely legal in java, but in C it will have undefined behavior.