Chapter 6: Problem 5
Find the error in each of the following program segments. Explain how to correct the error. a) int g() { System.out.println( "Inside method g" ); int 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, b = 5, c = 4, result; result = a * b * c; System.out.printf( "Result is %d\n", result ); return result;
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.