Find the error in each of the following program segments. Explain how to correct the error. a)
Question:
Find the error in each of the following program segments. Explain how to correct the error.
a)
void g() {
System.out.println("Inside method g");
void h() {
System.out.println("Inside method h");
}
}
b)
int sum(int x, int y) {
int result;
result = x + y;
}
c)
void f(float a); {
float a;
System.out.println(a);
}
d)
void product() {
int a = 6;
int b = 5;
int c = 4;
int result = a * b * c;
System.out.printf("Result is %d%n", result);
return result;
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Java How To Program Early Objects
ISBN: 9780134743356
11th Edition
Authors: Paul Deitel, Harvey Deitel
Question Posted: