Lec 2 30_jul13

629 views

Published on

Published in: Technology, News & Politics
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
629
On SlideShare
0
From Embeds
0
Number of Embeds
72
Actions
Shares
0
Downloads
29
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lec 2 30_jul13

  1. 1. Introduction to Java Lecture 2 Naveen Kumar
  2. 2. Why OOP? Modularization  Decompose problem into smaller subproblems that can be solved separately. 2
  3. 3. Why OOP? Abstraction -- Understandability  Individual modules are understandable by human readers. 3
  4. 4. Why OOP?  Encapsulation -- Information Hiding  Hide complexity from the user of a software. Protect low-level functionality. 4
  5. 5. Why OOP?  Composability -- Structured Design  Interfaces allow to freely combine modules to produce new systems. 5
  6. 6. Why OOP?  Hierarchy  Incremental development from small and simple to more complex modules. 6 Complexity increases
  7. 7. Why OOP?  Continuity  Changes and maintenance in only a few modules does not affect the architecture. 7
  8. 8. Main OOP Language Features  Classes: Modularization, structure.  Inheritance / extends: Hierarchy of modules, incremental development.  Public / Protected / Private: Encapsulation.  Interfaces / Abstract Classes: Composability.  Polymorphism / virtual: Hierarchy of modules, incremental development.  Templates: Type independent abstract data types.8
  9. 9. Why Java ?  Java is a general purpose object oriented programming language  Internet programming language 9
  10. 10. Java Book’s 1. Big Java (3rd Edition) Author : Cay Horstmann 2. The complete reference of java 2 (J2SE 6 Edition) Author : Herbert Schieldt 3. Programming in Java2 Author : E. Balagurusamy Web Source:  http://java.sun.com/docs/books/tutorial/  http://java.sun.com/javase/6/docs
  11. 11. History of Java  A general purpose OOP language  Developed by Sun Microsystems. (James Gostling)  Initially called “Oak” but was renamed as “Java” in 1995  Initial motivation is to develop a platform independent language to create software to be embedded in various consumer electronics devices  Become the language of internet (portability and security)
  12. 12. Compiled and Interpreted  Java works in two stage – Java compiler translate the source code into byte code – Java interpreter converts the byte code into machine level representation Byte Code: -A highly optimized set of instructions to be executed by the java runtime system, known as java virtual machine (JVM) -Not executable code JVM: - Need to be implemented for each platform - Although the details vary from machine to machine, all JVM understand the same byte code
  13. 13.  Java compiler produces an intermediate code known as byte code for a machine, known as JVM  It exists only inside the computer memory  Machine code is generated by the java interpreter by acting as an intermediary between the virtual machine and real machine Java Virtual Machine Java Program Java Compiler Bytecode Bytecode Java Interpreter Machine Code JVM
  14. 14. Characteristics of Java  Java Is Simple  Java Is Object-Oriented  Java Is Distributed  Java Is Interpreted  Java Is Robust  Java Is Secure  Java Is Architecture-Neutral  Java Is Portable  Java's Performance  Java Is Multithreaded  Java Is Dynamic 14 www.cs.armstrong.edu/liang/intro6e/JavaCharacteristics.pdf
  15. 15. Characteristics of Java  Java Is Simple  Java Is Object-Oriented  Java Is Distributed  Java Is Interpreted  Java Is Robust  Java Is Secure  Java Is Architecture-Neutral  Java Is Portable  Java's Performance  Java Is Multithreaded  Java Is Dynamic 15 Java is partially modeled on C++, but greatly simplified and improved. It is like C++ but with more functionality and fewer negative aspects
  16. 16. Characteristics of Java  Java Is Simple  Java Is Object-Oriented  Java Is Distributed  Java Is Interpreted  Java Is Robust  Java Is Secure  Java Is Architecture-Neutral  Java Is Portable  Java's Performance  Java Is Multithreaded  Java Is Dynamic 16 Java is inherently object-oriented. Java was designed from the start to be object-oriented. One of the central issues in software development is how to reuse code. Object-oriented programming provides great flexibility, modularity, clarity, and reusability through encapsulation, inheritance, and polymorphism.
  17. 17. Characteristics of Java  Java Is Simple  Java Is Object-Oriented  Java Is Distributed  Java Is Interpreted  Java Is Robust  Java Is Secure  Java Is Architecture-Neutral  Java Is Portable  Java's Performance  Java Is Multithreaded  Java Is Dynamic 17 Distributed computing involves several computers working together on a network. Java is designed to make distributed computing (e.g. Web Services) easy. Since networking capability is inherently integrated into Java, writing network programs is like sending and receiving data to and from a file
  18. 18. Characteristics of Java  Java Is Simple  Java Is Object-Oriented  Java Is Distributed  Java Is Interpreted  Java Is Robust  Java Is Secure  Java Is Architecture-Neutral  Java Is Portable  Java's Performance  Java Is Multithreaded  Java Is Dynamic 18 You need an interpreter to run Java programs. The programs are compiled into bytecode. The bytecode is machine- independent and can run on any machine that has a Java interpreter, which is part of the JVM

×