Lab 02 -- Chapter 01

Define the followint terms:

  • object, ** An object is cool.
  • class,
  • instance,
  • method,
  • signature,
  • parameter,
  • type,
  • state,
  • source code,
  • return value,
  • compiler

In Chapter 1 we have mentioned the data types int and String. Java has more predefined data types. Find out what they are and what they are used for. To do this, you can check Appendix B, or look it up in another Java book or in an online Java language manual. One such manual is at http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

What are the types of the following values?

  • 0
  • "hello"
  • 101
  • -1
  • true
  • "33"
  • 3.1415

What would you have to do to add a new field, for example one called name, to a circle object?

Write the header for a method named send that has one parameter of type String, and does not return a value.

Write the header for a method named average that has two parameters, both of type int, and returns an int value.

Look at the book you are reading right now. Is it an object or a class? If it is a class, name some objects. If it is an object, name its class.

Can an object have several different classes? Discuss.