Lesson 3 – Objects and Methods

Big Java 6

When you come in

  1. Connect to the Internet
  2. Log in to Piazza
  3. Start Bluej
  4. Navigate to laughton.com/obrien/sjsu/cs46a/CRT_lessons/ and open this lesson

Questions

Activity - Public Interface of Day class

Record your participation in Piazza clicker question Lesson3 Q1

Which methods of the Day class take a argument? Select all that apply. (Here is documenation for the Day class - opens in a new window)

  1. addDays
  2. daysFrom
  3. getDayOfMonth
  4. getMonth
  5. getYear
  6. toString

Activity - Public Interface of Day class

Record your participation in Piazza clicker question Lesson3 Q2

Which methods of the Day class return a value? Select all that apply.

  1. addDays
  2. daysFrom
  3. getDayOfMonth
  4. getMonth
  5. getYear
  6. toString

Activity - Public interface of the Picture class

Record your participation in Piazza clicker question Lesson3 Q3

The getHeight method of the Picture class returns a value. (Here is the picture class documentation - opens in a new window)

  1. true
  2. false

 

Activity - Public interface of the Picture class

Record your participation in Piazza clicker question Lesson3 Q4

The grow method of the Picture class returns a value

  1. true
  2. false

 

Activity - Public interface of the String class

Record your participation in Piazza clicker question Lesson3 Q5

Look at the Java API at the public interface of the String class. (In your search engine, type java api string. Then select String ...)

 

 

Activity - Constructing Objects - Rectangles

Record your participation in Piazza clicker question Lesson3 Q6

Let's work on a project together to draw a staircase like the one below. The upper left hand corner is at (20, 10). Each step is 20 pixels tall. The first step is 20 pixels wide. Each of the following steps is 20 pixels wider than the one above.

screen shot of stairviewer output

 

 

Activity - Using String methods

Record your participation in Piazza clicker question Lesson3 Q7

Let's experiment with String methods