Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview Object oriented programming How to run a simple program.

Similar presentations


Presentation on theme: "Overview Object oriented programming How to run a simple program."— Presentation transcript:

1 Overview Object oriented programming How to run a simple program

2 Programming languages Machine languages 1's and 0's; machine- dependent Assembly languages: English-like abbreviations; elementary operations High-level languages: single statements could be written to accomplish substantial tasks.

3 Example (Programming languages) Machine languages: +1300042774 +1400493419 +1200274027 Assembly languages: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY High-level languages: grossPay = basePay +overTimePay

4 Objects An object has: – state - descriptive characteristics – behaviors - what it can do (or be done to it) For example, a particular bank account – has an account number – has a current balance – can be deposited into – can be withdrawn from

5 Bank account object example tomsSaving int acountNumber = 123456789; int currentBalance = 30000; deposit(int x); withdraw(int y);

6 Classes A class is a blueprint of an object It is the model or pattern from which objects are created A class defines the methods and types of data associated with an object Creating an object from a class is called instantiation; an object is an instance of a particular class For example, the Account class could describe many bank accounts, but toms_savings is a particular bank account with a particular balance.

7 Bank account class example public class bankAccount{ int balance; int accountNumber; public BankAccount(){ } public void withdraw(int x){ … … } public void deposit(int x){ …... }

8 Variables A variable is a container A variable has a type A variable has a value A variable can change its value

9 Assignment statement Example integer age = 25; type name assignment symbol initial value “=” is not the equality symbol

10 Programming process Use an editor to type in the program Use a compiler to translate the program into machine code. Use Java Virtual Machine to run the program.

11 Programming process ideas Program text, on paper or in head Work done at the keyboard with a text editor Program text, in a file such as Test.java Compiler-- a program for translating programs Program in Java byte code, in the file Test.class Java Virtual Machine JVM, executes the program Test.class

12 IDE(Integrated Development Environment) IDE consists of: –a text editor (Notepad is fine too) –a compiler (the JDK's javac, where JDK is the Java Development Kit) –a Java Virtual Machine (JVM) Java IDE Examples –Code Warrior –Visual Age Java(IBM) –Visual Café

13 Summary class, object identifier variable statement, assignment statement editor, compiler, JVM, IDE


Download ppt "Overview Object oriented programming How to run a simple program."

Similar presentations


Ads by Google