10
February 2 - 6, 2009

February 2 - 6, 2009. 2/4: Go over review sheet for Exam 1 2/6: Exam 1 & Lab 1 due 2/9: Go over Exam 1 2/11: Makeup exam for Exam 1

Embed Size (px)

Citation preview

Page 1: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

February 2 - 6, 2009

Page 2: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

2/4: Go over review sheet for Exam 1 2/6: Exam 1 & Lab 1 due 2/9: Go over Exam 1 2/11: Makeup exam for Exam 1

Page 3: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1
Page 4: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1
Page 5: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

Java programs are made up of Java source code files that contain Java source code, are compiled by the compiler and then run using the run-time environment.

These Java source code files all have a filename and an extension.The filename corresponds to the name of

the class defined in the file.The extension is .java

Page 6: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

Contain the definition of one class. The class’ name determines the name

of the file. A class is a definition of a set of objects.

You should think of a class like a blueprint, a rubber stamp, a mold.This definition tells us exactly what a

particular instance (object) should be like and how it should behave.

Page 7: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

public class Name {

}

Name is the name that the programmer gives to the class.

Page 8: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

The definition on the previous slide is a valid class definition.

However the class that was defined is not very interesting. It doesn’t do anything.

We need to put some stuff inside the { } to help define what objects of this class should do.

Page 9: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

The first thing we will learn about putting inside the { } (called the class’ body) are methods.

We have been calling methods to have objects we created do something for us.

Now we will be writing the definition of what those methods should do.

Page 10: February 2 - 6, 2009.  2/4: Go over review sheet for Exam 1  2/6: Exam 1 & Lab 1 due  2/9: Go over Exam 1  2/11: Makeup exam for Exam 1

public returnType nameOfMethod() {

}

returnType is the type of information that is returned from this method

nameOfMethod is the name that the programmer picks for this method

() is called a parameter list when we write the definition of a method