Test2 - // a new string literal. // // d. Remove the last...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Test2.java Author: Lewis and Loftus // // Solution to Programming Project 1.2 //******************************************************************** / class Test2 { //----------------------------------------------------------------- // Tests various modifications to the program. //----------------------------------------------------------------- public static void main (String[] args) { System.out.println ("An Emergency Broadcast"); } } // // a. Change Test to test // // The compiler produces the bytecode file name based on the // class name (not the source code file name), so the bytecode // file name has a lower case t. // // b. Change Emergency to emergency // // The program compiles fine, and when executed prints the word // emergency with a lower case e. // // c. Remove the first quotation mark in the string literal // // The compiler produces an error: String not terminated at end // of line. It interpreted the last quote as the beginning of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // a new string literal. // // d. Remove the last quotation mark in the string literal // // The compiler produces the same error as in part c. // // e. Change main to man // // The program compiles, but when submitted to the interpreter // it complains that the main method could not be found. // // f. Change println to bogus // // The compiler produces an error that says method bogus is not // found in class java.io.PrintStream. // // g. Change Broadcast to Brxoadxcaxst // // As with part b, the output changes to reflect the changes // made to the string literal. // // h. Remove the semicolon at the end of the println statement // // The compiler produces an error indicating that there is a // semicolon missing at the end of the println statement. // // i. Remove the last brace in the program // // The compiler produces an error indicating that there should // be a brace at the end of the program. //...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

Test2 - // a new string literal. // // d. Remove the last...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online