Computer Science 202
Introduction to Programming

Fall 2012, The College of Saint Rose

Lecture 4: Java Fundamentals
Date: Thursday, September 6, 2012

Agenda

Lecture Assignment 4

Due at the start of class, Tuesday, September 11.

Please submit answers to these questions in Blackboard by the start of class. We will discuss these questions at the start of class, so no late submissions are accepted.

  1. Consider the following names that a programmer is considering for use as variable names in a Java program. For each one, indicate whether it is a valid Java identifier. If it is valid, does it conform to the Java naming convention for variables? For all names that are either invalid or do not conform to the naming convention, suggest a similar name that would be appropriate to use instead. (5 points)
    KNIGHT
    202assignments
    FavoriteColor
    darth vader
    BugsBunny!
    WHEN_IS_LUNCH?
    gotCash$$
    jeter2
    little Red Wagon
    school_name
    
  2. Write a simpler Java statement that is equivalent to the following: (2 points)
      System.out.print("Hi " + "there.\n");
      System.out.print("I really, really like ");
      System.out.println("this class!");
    

Examples