Running Test.java throws error run:
Exception in thread “main” java.lang.RuntimeException: Uncompilable source code – Erroneous tree type:
at algorithms.Test.main(Test.java:9)
Both files are present in same directory “algorithms” and package algorithms is also mentioned in the beginning of each file.
What is the issue in running main() of Test?
Gcd.java file
package algorithms;
public class Gcd {
public static int ComputeGcd(int number1, int number2){
if(number2 == 0){ return number1;}
else{
int remainder = number1 % number2;
return ComputeGcd(number2,remainder);
}
}
public static void main(String[] args) {
int a = 32;
int b = 12;
System.out.println(ComputeGcd(a,b));
}
}
Test.java file
package algorithms;
public class Test {
public static void main(String[] args) {
int a = 32;
int b = 12;
System.out.println(ComputeGcd(a,b));
}
}
try using:
instead of: