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

Hi,

I have modified the code and highlighted the code changes below.

Test.java

public class Test {
   public static void method1(int n,int m) {
   n += m;
   method2(3.4);
   }
   public static int method2(double n) {
   if (n > 0) return 1;
   else if (n < 0) return -1;
   return 0;
  
}
   }

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); } p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site