I have virtually no java/eclipse experience, so bear with me. I have written a code to use the Euclidean algorithm to compute a greatest common divisor.
public class Euclid {
public static int gcd(int a, int b){
while (b!= 0){
if (a > b){
a -= b;
}
else {
b -= a;
}
}
return a;
}
}
How would I go about testing this in the eclipse console to ensure that it runs properly? E.g were I using python, which I have some experience with, I'd think to simply type gcd(32, 24) into IDLE and hit enter.
mainmethod, and put some prints in it. Java is not an interpreted language so things like "IDLE" do not exist. But for small programs, compilation is pretty quick and this will give you the fastest results.