CIS 17: Java Programming

Project B

Objective:

To exercise selected operators from C/C++ and to determine their behaviors in the Java environment.

Strings and Operators

// ...
  
  boolean result;
  String string1, string2;
  
  // ...  

  result = string1.equals(string2);

// ...
public static void main(String[] args) {
  compare("\"Hello\" vs \"Hello\"", "Hello", "Hello");
  String s = new String("Hello");
  compare("\"Hello\" vs s", "Hello", s);
  compare("\"Hello\" vs \"Goodbye\"", "Hello", "Goodbye");
}
Using the Modulus Operator and the for Statement

Submit your work via the CATE form for Project B.

Legend: method/function keyword literal

2007/03/03