CS 160

January 30, 2004

Today's lecture started with some more info on print statements. Using print vs. println. Using the escape character '\' and casting from int -> char and char -> int.
The second part was importing packages from the Java API. We imported in the Rectangle class and instantiated a Rectangle in the constructor of another class that was instantiated inside the main method.
Remember
  • Constructors have no return values
  • All other methods have return values
  • All methods have input paramters
  • When calling a method you have to match up the sending paramters with the type and number of parameters the method is expecting.
  • When instantiating a class you have to declare a variable of the type of the class you are instantiating and then call the constructor with the new keyword.
The Printing Program The Rectangle Program


This is the program I will be covering on Monday. We will be instantiating more classes, calling methods returning values from methods and much, much more. I feel like a car salesman.
The Parent The Baby