Question: Consider the following program, saved into a file named Example.java: What would happen if each of the following changes were made to the Example program?
Consider the following program, saved into a file named Example.java:

What would happen if each of the following changes were made to the Example program? For example, would there be no effect, a syntax error, or a different program output? Treat each change independently of the others.
a. Change line 1 to: public class Demonstration
b. Change line 9 to: public static void MAIN(String[] args) {
c. Insert a new line after line 11 that reads:
System.out.println();
d. Change line 2 to: public static void printMessage() {
e. Change line 2 to: public static void showMessage() { and change lines 11 and 12 to: showMessage();
f. Replace lines 3–4 with: System.out.println( " The first rule of Java Club is, " );
public class Example { public static void displayRule () { System.out.println ("The first rule "); System.out.println ("of Java Club is, "); System.out.println (); System.out.println ("you do not talk about Java Club."); public static void main (String[] args) { System.out.println ("The rules of Java Club."); displayRule () ; displayRule () ; }
Step by Step Solution
3.53 Rating (167 Votes )
There are 3 Steps involved in it
Mistakes in Example program a Syntax error The program would not com... View full answer
Get step-by-step solutions from verified subject matter experts
