CS49J Lesson 2 – Objects

Ch 1: 1.3-1.5 & Ch 2: 2.1-2.6

Big Java 6

When you come in

  1. Connect to the Internet
  2. Log in to Piazza
  3. Start Eclipse or your IDE
  4. Navigate to laughton.com/obrien/sjsu/
    cs49j/lessons and open this lesson

Questions

Activity - Homework Project

Record your participation in Piazza clicker question Lesson2 Q1

We are going to start at the beginning and set up hw1b together

Activity - Deciphering Syntax Errors

Record your participation in Piazza clicker question Lesson2 Q2

One of the challenges in learning a new programming language is to be able to decipher syntax error messages

Let's practice

Activity - Accessor and mutators

Record your participation in Piazza clicker question Lesson2 Q3

 

 

Activity - Accessors and mutators

Record your participation in Piazza clicker question Lesson2 Q4

Look at the String class in the API class. Find an accessor. Find a mutator.

 

Activity - Compiling

Record your participation in Piazza clicker question Lesson2 Q5

What is created when you compile a Java source file

  1. object code
  2. byte code
  3. You do not compile Java. It is an interpreted language
  4. None of the above

Concept - new operator

Objects are always created using the new operator

Concept - creating a String object

Activity - Creating objects

Record your participation in Piazza clicker question Lesson2 Q6

Which statement creates a Rectangle object?

  1. Rectangle box;
  2. box = Rectangle(10, 20, 100, 50);
  3. new Rectangle(10, 20, 100, 50);