Answer the question
In order to leave comments, you need to log in
Does java lie (is always false)?
Provided that the parameter x changes every second. Should this code work?
Java says that first > second is always false.
You just need to find out in which direction the x parameter changes. The x parameter is the distance. And am I implementing this method correctly?
protected boolean distanceUpDownChecker(int x) {
boolean q;
int first;
int second;
first = x;
try {
TimeUnit.SECONDS.sleep(3);
}catch (InterruptedException e){
e.printStackTrace();
}
second = x;
q = first > second;
return q;
}
Answer the question
In order to leave comments, you need to log in
Does anyone have an idea how to implement this? I need to know if I am approaching a certain point, or moving away!
When approaching a point in the region of 950-1000 meters, the program gives a signal. After passing this point, when the same 950-1000 meters are removed, a signal is again given, which is no longer needed. Just trying to get rid of it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question