Download presentation
Presentation is loading. Please wait.
1
Road to Object Oriented Programming
Advanced programming ce244 Sharif University of Technology Feb 2007 Sunday, February 18, 2007 Taha Abachi
2
Outline Deadlines Objects Object Oriented Languages
Editing your first java program Compiling, running and debugging Homework 5/5/2019 Taha Abachi
3
Deadlines By the end of the week you should have : The Java CD
Java installed on your machines Edited, run, debugged your first Java programs without any trouble Examined Java IDEs 5/5/2019 Taha Abachi
4
Objects Abstraction Definition Programming languages Problem space
State : internal data Behavior : methods Identity : each object can be uniquely distinguished from every other object 5/5/2019 Taha Abachi
5
Features of an Object An object has an interface
An object provides services The hidden implementation Data encapsulation Reusing the implementation Inheritance:reusing the interface 5/5/2019 Taha Abachi
6
Features of an Object (cont’d)
Sample object Date : Day : 1..31 Month : 1..12 Year : Problems Inconsistent data: no dependency to other fields Day := 32 Inflexible representation Date : longint Date := days passed after a specific date 5/5/2019 Taha Abachi
7
Features of an Object (cont’d)
Clients of the code Yourself Teammates Customers An infant programmer Solution : Separating implementation form interface More Secure and flexible 5/5/2019 Taha Abachi
8
Object Oriented Languages
Everything is an object. A program is a bunch of objects telling each other what to do by sending messages. Each object has its own memory made up of other objects. Every object has a type. All objects of a particular type can receive the same messages. 5/5/2019 Taha Abachi
9
Installing Java Install JDK Install Java Documentation
API(Application programming Interface) Set Environment variables Choose a text editor 5/5/2019 Taha Abachi
10
Java Characteristics Portability : Interpreting : JVM
compile programs to a intermediary format called JBC C:\>javac HelloWorld.java to produce HelloWorld.class Interpreting : JVM 5/5/2019 Taha Abachi
11
Portability 5/5/2019 Taha Abachi
12
Java is Object Oriented
Every thing in Java is an Object. Objects in OOP mirror the properties and behavior of the real world objects. They have their own set of data and functions (called method) that operate on these data. 5/5/2019 Taha Abachi
13
First Program in Java Use a text editor Write down your program
Java is case sensitive Compile your program Run 5/5/2019 Taha Abachi
14
HelloWorld public class HelloWorld {
public static void main(String[] args) { System.out.println("Hello World"); } 5/5/2019 Taha Abachi
15
Java program files Each class is saved in a file of the same name with java extension. Note java is case sensitive language, even as far as the class file names are concerned. The Hello class should be saved in a file called HelloWorld.java class . 5/5/2019 Taha Abachi
16
Syntax Highlighting public class HelloWorld {
public static void main(String[] args) { System.out.println("Hello World"); } 5/5/2019 Taha Abachi
17
The method main ( ) The main() method is the point where a Java program starts running. Any executable Java class must have the main() method in this specific format: public static void main(String[ ] args){ ………….. } 5/5/2019 Taha Abachi
18
Time to compile Use javac command to compile your java programms :
C:\> javac HelloWorld.java HelloWorld.class (JBC file) is created You may face some errors Correct erroneous parts and compile again 5/5/2019 Taha Abachi
19
Run The Java command is used to run the class (JBC) file:
c:\> Java HelloWorld 5/5/2019 Taha Abachi
20
You are a Java programmer NOW!
Congratulations You are a Java programmer NOW! 5/5/2019 Taha Abachi
21
Java Development Environments
Sun's JDK is not an environment. Sun's Java Workshop Microsoft's Visual J++ Symantec's Cafe Borland's J Builder Metrowerks' Code Warrior Tek-Tools' Kawa. 5/5/2019 Taha Abachi
22
Java Development Environments
My candidates : IntelliJ IDEA Eclipse Textpad 5/5/2019 Taha Abachi
23
Homework Install Java properly Write and Test you first Java program
Design an object oriented environment for manipulating geometrical shapes : Different subtypes (square, circle, etc.) Common characteristics (fields & methods) Particular characteristics Use UML (Unified Modeling Language) notation 5/5/2019 Taha Abachi
24
Questions? 5/5/2019 Taha Abachi
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.