Presentation is loading. Please wait.

Presentation is loading. Please wait.

Crash Course in Java Fall 2012 AP Computer Science Ms. Luttrell.

Similar presentations


Presentation on theme: "Crash Course in Java Fall 2012 AP Computer Science Ms. Luttrell."— Presentation transcript:

1 Crash Course in Java Fall 2012 AP Computer Science Ms. Luttrell

2 What is Java? It is a programming language and computing platform. Released by Sun Microsystems in 1995. It is the underlying technology that powers state-of- the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices.

3 Sample Program

4 Java Buzzwords Class Object Method Parameter

5 What is a Class? Simply put…it’s a program that contains code.

6 Two Types of Classes 1.) Classes that generate objects. 2.) Classes that implement a program. (Driver classes, Tester classes, Runner classes)

7 What is an object generating Class? It’s a blueprint that can be used to build an object and it describes what actions that object can perform

8 What does the Bicycle class (blueprint) look like? Default Constructor Another Constructor Action (method) Class Name

9 Bicycle API (Application Programming Interface)

10 What is a class that implements a program? These are commonly called Driver classes (also Runners or Testers) This is where you come in!

11 Bicycle Driver Class “PSVM”

12 What is an object? It is an instance of the class (???) It is a physical manifestation of the class (blueprint) that can actually take action

13 Class Object

14 How do you create an object? ClassName objectName = new ClassName (parameters); How would we create a bicycle object? Bicycle myBicycle = new Bicycle( ); or Bicycle myBicycle = new Bicycle(“Schwinn”, 5, 3, false);

15 Once an object is created it can take action slowdown(); increaseSpeed(); setGear();

16 What is a Method? It’s any action that the object can take. Action  Method

17 Bicycle API (Application Programming Interface)

18 How do you call a method? 1.) Create an object (we already discussed this) Bicycle myBicycle = new Bicycle( ); or Bicycle myBicycle = new Bicycle(“Schwinn”, 5, 3, false); 2.) Call the method using this structure: objectName.method( parameter);

19 Examples of calling a Method myBicycle.increaseSpeed( ); myBicycle.slowDown( ); myBicycle.setSpeeds(5); myBicycle.setGear(3);

20 What is a Parameter? It is a value (numeric or maybe something else) that is passed to a method so that the method can use that value in its processing. myBicycle.setSpeeds(5); parameter


Download ppt "Crash Course in Java Fall 2012 AP Computer Science Ms. Luttrell."

Similar presentations


Ads by Google