Classic bugsTag(s): Varia


Here some common mistakes :

1:

int x = 0;

for( x=0; x<10; x++ );{
 System.out.println("Print only once, why not 10 times ?");
 }

2:

int i = 0;

if (i = 0){
 System.out.println("Won't print, why ?");
 }

3:

public class WontCompile {
    public static void main(String[] args) {
        getInt(09);
    }

    private static void getInt(int i) {
        System.out.println(i);
    }
}

4:

// this don't do what it is supposed to do
void setIsDirtyData(boolean isdirtyData) {this.isDirtyData = isDirtyData;} 


blog comments powered by Disqus