Presentation is loading. Please wait.

Presentation is loading. Please wait.

February 2 - 6, 2009 CSE 113 B.

Similar presentations


Presentation on theme: "February 2 - 6, 2009 CSE 113 B."— Presentation transcript:

1 February 2 - 6, 2009 CSE 113 B

2 Announcements 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

3

4

5 Writing programs outside of interactions pane
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

6 Java source code files 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.

7 Class definition syntax
public class Name { } Name is the name that the programmer gives to the class.

8 Class definition syntax
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.

9 Inside Class Body 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.

10 Method definition syntax
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


Download ppt "February 2 - 6, 2009 CSE 113 B."

Similar presentations


Ads by Google