M. Masud Tarek masudtarek@outlook.com
 OOP principles  Java Features  Data Types  Control Statements  Array, String basics  Classes  Inheritance Masud Tarek masudtarek@outlook.com 2
 Interfaces  Packages  Exception Handling  Multithreaded Programming  String Handling  Java I/O and File Handling  Java Applet  Java GUI Programming  Enumeration, Auto-Boxing and Un-Boxing Masud Tarek masudtarek@outlook.com 3
 Network Programming  Generics  Java Collection Framework  Concurrency Utilities and Parallel Programming Masud Tarek masudtarek@outlook.com 4
 Attendance (10%)  Class Performance (20%)  Class tests  Assignments  Midterm (30%)  Final (40%) Masud Tarek masudtarek@outlook.com 5
 Java – The Complete Reference ◦ Herbert Schildt (8th Edition)  http://docs.oracle.com/javase/tutorial/getStarted/  Thinking in Java ◦ Bruce Eckel  Java – How to Program ◦ H. M. Dietel  Teach Yourself Java in 21 days (sams.net) ◦ Laura Lemay, C. L. Perkins  Other web addresses given during lectures Masud Tarek masudtarek@outlook.com 6
 What is OOP?  OOP Principles  Java as OOP Language Masud Tarek masudtarek@outlook.com 7
 What is OOP? ◦ OOP is a programming methodology that helps organize complex program through the use of some principles (known as OOP principles: inheritance, encapsulations, polymorphism) Masud Tarek masudtarek@outlook.com 8
 Programming approach changes with the invention of new computers and technology  Machine Code and Assembly Language ◦ Very hard to write and manage programs  Structured Programming Language ◦ Structured, efficient high level language ◦ Easy to debug and manage mid size programs ◦ Single flow of program Masud Tarek masudtarek@outlook.com 9
 Object Oriented Programming ◦ Reusable software components ◦ Meaningful and real world model  Employee objects, Pay-check objects, Invoice objects ◦ Better organized, understandable, easier to maintain ◦ Usually no single flow. Objects can communicate each other using some predefined methods Masud Tarek masudtarek@outlook.com 10
 All programs have two elements: ◦ Code and Data ◦ Process Oriented Model – “what is happening”  Program conceptually organized around code ◦ Object Oriented Model – “who is affecting”  Program conceptually organized around data  OOP important element ◦ Abstraction Masud Tarek masudtarek@outlook.com 11
 OOP principles ◦ Encapsulation  Mechanism to bind code and data it manipulates  Protective wrapper  In Java, basis is CLASS – logical construct  Defined data by class – member variables  Code operate on data – member method ◦ Inheritance  Hierarchical classification (Top Down)  One object acquires properties of another ◦ Polymorphism  Use one interface to be used for general class of action Masud Tarek masudtarek@outlook.com 12
 Developed by Sun Microsystems 1991-1995  Originally called “Oak”  A general-purpose object-oriented language  Syntax similar to C/C++  Designed for easy Web/Internet applications Masud Tarek masudtarek@outlook.com 13
 Simple  Secure  Portable  Robust  Multithreaded  Architecture-neutral  High performance  Distributed  Dynamic Masud Tarek masudtarek@outlook.com 14
 Simple ◦ Easy to learn (syntax similar to C++) ◦ No confusing Pointer usage ◦ Less or no Memory Leaks Masud Tarek masudtarek@outlook.com 15
 Secured and Robust ◦ No direct access into the memory via pointer, so more secured. ◦ Java programs can run a variety of platform ◦ Unlike C++, programmers do no have to free memory by coding, so memory is managed easily. Masud Tarek masudtarek@outlook.com 16
 Architecture-neutral ◦ Write once, run anywhere, any time  Interpreted and High Performance ◦ Just-in-Time Compiler can be used to efficiently convert java byte code to native machine code Java Source Code Java Bytecode Compiler (javac) Java Bytecode Execution JIT Compiler or Interpreter Masud Tarek masudtarek@outlook.com 17
 Portable ◦ Standard (fixed) data sizes:  byte = 8 bits float = 32 bits  short = 16 bits double = 64 bits  int = 32 bit unicode characters  long = 64 bits ◦ Libraries: Java includes libraries for graphics, sound, etc., and these are implemented on all machines (UNIX, Windows 95, Mac…) Masud Tarek masudtarek@outlook.com 18
 Network and Multithreaded ◦ Java has easy to use Network and Multithreaded techniques.  Distributed ◦ Java is designed for distributed environment of the internet as it handles TCP/IP protocols Masud Tarek masudtarek@outlook.com 19
 Java: The Complete Reference (Herbert Schildt) (8th Edition or later) ◦ Chapter 1 and 2 Review questions: 1. What are the principles of OOP. Discuss briefly. 2. List some characteristics of Java program? 3. Discuss briefly why java programs are considered Portable and Architecture-neutral. 4. Why Java is more secured by not using pointers?

01 introduction to oop and java

  • 1.
  • 2.
     OOP principles Java Features  Data Types  Control Statements  Array, String basics  Classes  Inheritance Masud Tarek masudtarek@outlook.com 2
  • 3.
     Interfaces  Packages Exception Handling  Multithreaded Programming  String Handling  Java I/O and File Handling  Java Applet  Java GUI Programming  Enumeration, Auto-Boxing and Un-Boxing Masud Tarek masudtarek@outlook.com 3
  • 4.
     Network Programming Generics  Java Collection Framework  Concurrency Utilities and Parallel Programming Masud Tarek masudtarek@outlook.com 4
  • 5.
     Attendance (10%) Class Performance (20%)  Class tests  Assignments  Midterm (30%)  Final (40%) Masud Tarek masudtarek@outlook.com 5
  • 6.
     Java –The Complete Reference ◦ Herbert Schildt (8th Edition)  http://docs.oracle.com/javase/tutorial/getStarted/  Thinking in Java ◦ Bruce Eckel  Java – How to Program ◦ H. M. Dietel  Teach Yourself Java in 21 days (sams.net) ◦ Laura Lemay, C. L. Perkins  Other web addresses given during lectures Masud Tarek masudtarek@outlook.com 6
  • 7.
     What isOOP?  OOP Principles  Java as OOP Language Masud Tarek masudtarek@outlook.com 7
  • 8.
     What isOOP? ◦ OOP is a programming methodology that helps organize complex program through the use of some principles (known as OOP principles: inheritance, encapsulations, polymorphism) Masud Tarek masudtarek@outlook.com 8
  • 9.
     Programming approachchanges with the invention of new computers and technology  Machine Code and Assembly Language ◦ Very hard to write and manage programs  Structured Programming Language ◦ Structured, efficient high level language ◦ Easy to debug and manage mid size programs ◦ Single flow of program Masud Tarek masudtarek@outlook.com 9
  • 10.
     Object OrientedProgramming ◦ Reusable software components ◦ Meaningful and real world model  Employee objects, Pay-check objects, Invoice objects ◦ Better organized, understandable, easier to maintain ◦ Usually no single flow. Objects can communicate each other using some predefined methods Masud Tarek masudtarek@outlook.com 10
  • 11.
     All programshave two elements: ◦ Code and Data ◦ Process Oriented Model – “what is happening”  Program conceptually organized around code ◦ Object Oriented Model – “who is affecting”  Program conceptually organized around data  OOP important element ◦ Abstraction Masud Tarek masudtarek@outlook.com 11
  • 12.
     OOP principles ◦Encapsulation  Mechanism to bind code and data it manipulates  Protective wrapper  In Java, basis is CLASS – logical construct  Defined data by class – member variables  Code operate on data – member method ◦ Inheritance  Hierarchical classification (Top Down)  One object acquires properties of another ◦ Polymorphism  Use one interface to be used for general class of action Masud Tarek masudtarek@outlook.com 12
  • 13.
     Developed bySun Microsystems 1991-1995  Originally called “Oak”  A general-purpose object-oriented language  Syntax similar to C/C++  Designed for easy Web/Internet applications Masud Tarek masudtarek@outlook.com 13
  • 14.
     Simple  Secure Portable  Robust  Multithreaded  Architecture-neutral  High performance  Distributed  Dynamic Masud Tarek masudtarek@outlook.com 14
  • 15.
     Simple ◦ Easyto learn (syntax similar to C++) ◦ No confusing Pointer usage ◦ Less or no Memory Leaks Masud Tarek masudtarek@outlook.com 15
  • 16.
     Secured andRobust ◦ No direct access into the memory via pointer, so more secured. ◦ Java programs can run a variety of platform ◦ Unlike C++, programmers do no have to free memory by coding, so memory is managed easily. Masud Tarek masudtarek@outlook.com 16
  • 17.
     Architecture-neutral ◦ Writeonce, run anywhere, any time  Interpreted and High Performance ◦ Just-in-Time Compiler can be used to efficiently convert java byte code to native machine code Java Source Code Java Bytecode Compiler (javac) Java Bytecode Execution JIT Compiler or Interpreter Masud Tarek masudtarek@outlook.com 17
  • 18.
     Portable ◦ Standard(fixed) data sizes:  byte = 8 bits float = 32 bits  short = 16 bits double = 64 bits  int = 32 bit unicode characters  long = 64 bits ◦ Libraries: Java includes libraries for graphics, sound, etc., and these are implemented on all machines (UNIX, Windows 95, Mac…) Masud Tarek masudtarek@outlook.com 18
  • 19.
     Network andMultithreaded ◦ Java has easy to use Network and Multithreaded techniques.  Distributed ◦ Java is designed for distributed environment of the internet as it handles TCP/IP protocols Masud Tarek masudtarek@outlook.com 19
  • 20.
     Java: TheComplete Reference (Herbert Schildt) (8th Edition or later) ◦ Chapter 1 and 2 Review questions: 1. What are the principles of OOP. Discuss briefly. 2. List some characteristics of Java program? 3. Discuss briefly why java programs are considered Portable and Architecture-neutral. 4. Why Java is more secured by not using pointers?