I think I have problem with compiling a java file

Baran SAHİN :

I am writing a game with java. I have more then one classes. I notice that if I am not changing the name of functions or variables. When I compile the code from the class includes main function it is not compiling the other classes and running the old version. For example I have below function which is can't return 1 in my opinion. But it is returning value 1 because the old version of this function returns 1. Not just this, I experienced this so many times. I am compiling from terminal with javac command. Here is my function:

public class CollisionMaker{
        public int makeCollision(GameObject a,GameObject b){
                int minxa = a.getx();
                int maxxa = a.getx()+a.getwidth();
                int minya = a.gety();
                int maxya = a.gety()+a.getheight();

                int minxb = b.getx();
                int maxxb = b.getx()+b.getwidth();
                int minyb = b.gety();
                int maxyb = b.gety()+b.getheight();

                int d1x = minxb-maxxa;
                int d1y = minyb-maxya;
                int d2x = minxa-maxxb;
                int d2y = minya-maxyb;

                int highest = d1x;
                int highest_id = 0;
                if(d1x >= highest){highest = d1x;highest_id = 2;}
                if(d1y > highest){highest = d1y;highest_id = 2;}
                if(d2x > highest){highest = d2x;highest_id = 3;}
                if(d2y > highest){highest = d2y;highest_id = 4;}

                if(d1x > 0 || d1y > 0){return 0;}
                else if(d2x > 0 || d2y > 0){return 0;}
                else{return highest_id;}
        }
}
sveinni :

There are several ways to make sure you compile all (changes) classes. Please check out the answers to javac option to compile all java files under a given directory recursively

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=374411&siteId=1