Question: Find the error in each of the following program segments. Explain how to correct the error. 1. public static void goo() { System.out.println(Inside method goo);

Find the error in each of the following program segments. Explain how to correct the error.

1. public static void goo()

{

System.out.println("Inside method goo");

public static void foo()

{

System.out.println("Inside method foo");

}

}

2. public static int sum(int x, int y)

{

int result; result = x + y;

}

3. public static void f(float a);

{ float a; System.out.println(a);

}

4. public static void product()

{

int a = 6, b = 5, c = 4, result; result = a * b * c;

System.out.printf("Result is %d%n", result);

return result;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!