Identify and correct the errors in the following program Use
Identify and correct the errors in the following program: Use Netbeans IDE 8.1
public class Test {
public static method1(int n, m) {
n += m; 4 method2(3.4);
}
public static int method2(int n) {
if (n > 0) return 1;
else if (n == 0) return 0;
else if (n < 0) return –1;
}
}
Solution
public class test1 {
public static void method1(int n,int m) {
n += m;
int x= method2(3.4);
}
public static int method2(double n) {
if (n > 0) return 1;
else if (n == 0) return 0;
else return -1;
}
}
