Errors2 - int number; int numSq; System.out.print...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// File: Errors.java // Purpose: A program with lots of syntax errors // Correct all of the errors (STUDY the program carefully!!) import cs1.Keyboard; // No # symbol in an import statement // Class name must match file name including case and the convention is // to capitalize class names. Hence the class name should be Errors not // errors. public class Errors2 { public static void main (String[] args) { String Name; // Name of the user -- two slashes for a comment
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int number; int numSq; System.out.print ("Enter your name, please: "); // missing semicolon Name = Keyboard.readString(); // Name is a String not an int System.out.print ("What is your favorite number? "); number = Keyboard.readInt(); numSq = number * number; System.out.println (Name + ", the square of your number is " + numSq); // Missing the concatenation operator + } // Missing a closing brace }...
View Full Document

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Ask a homework question - tutors are online