Object-oriented Programming Using C++ and Java

Book description

This book offers contemporary, comprehensive and in-depth coverage of all the concepts of object-oriented technologies, with an emphasis on problem-solving approaches as applied to C++ and Java Programming paradigms.

Table of contents

  1. Cover
  2. Title Page
  3. Brief Contents
  4. Contents
  5. About the Author
  6. Dedication
  7. Preface
  8. How to Use This Book and Web Resources
  9. 1. Object-oriented Programming Basics
    1. 1.1 Introduction
    2. 1.2 Programming Concepts
    3. 1.3 Programming Paradigms
      1. 1.3.1 Structured Programming Paradigm
      2. 1.3.2 C: A Workhorse that Works Well
      3. 1.3.3 Where is the Problem?
      4. 1.3.4 Object-oriented Programming Paradigm
    4. 1.4 History and Development of Object-oriented Languages
      1. 1.4.1 C++
      2. 1.4.2 Java
      3. 1.4.3 C#
    5. 1.5 Software Development Methodologies
    6. 1.6 Need for Objects
    7. 1.7 Object-oriented Language Features
      1. 1.7.1 Object-based Programming
      2. 1.7.2 Object-oriented Programming
    8. 1.8 Definition of OOP Language Classes and Objects
      1. 1.8.1 Attributes and Behaviours of Objects
      2. 1.8.2 Class
      3. 1.8.3 Encapsulation
      4. 1.8.4 Data Hiding/Data Abstraction
      5. 1.8.5 Function Overloading
      6. 1.8.6 Operator Overloading
    9. 1.9 Extendibility and Reusability of OOP Paradigms
    10. 1.10 Extending/Deriving New Classes
      1. 1.10.1 Containment: Class Within a Class - Container Class
      2. 1.10.2 Inheritance and Class Hierarchy
      3. 1.10.3 Single and Multiple Inheritances
    11. 1.11 Virtual Functions
    12. 1.12 Run-time Polymorphism and Dynamic Data Binding
    13. 1.13 Class as Abstract Data Type (ADT)
    14. 1.14 Standard Template Library (STL)
    15. 1.15 OOPS - Object-oriented Programming and Systems
    16. 1.16 Object-oriented Analysis and Design (OOAD)
    17. 1.17 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Solutions to Objective Questions
  10. 2. Object Modelling
    1. 2.1 Introduction
    2. 2.2 Object Model
    3. 2.3 Object-oriented Design
    4. 2.4 Classes and Objects
      1. 2.4.1 Class
      2. 2.4.2 Notations and Meta Models
      3. 2.4.3 Mandatory Profile
      4. 2.4.4 Meta Data - Meta Class
      5. 2.4.5 Constraints
      6. 2.4.6 Object Creation
      7. 2.4.7 Garbage Collection
    5. 2.5 Object Properties
    6. 2.6 Links
    7. 2.7 Class Diagrams
    8. 2.8 Class Hierarchy
      1. 2.8.1 Associations
      2. 2.8.2 Hierarchies with Interdependent Classes
      3. 2.8.3 Hierarchies with Independent Classes
    9. 2.9 Object Diagrams
    10. 2.10 Communications and Message Passing
    11. 2.11 Polymorphism
    12. 2.12 Abstract Class
    13. 2.13 Concrete Class
      1. 2.13.1 OOPS - A Case Study in Object Modelling
    14. 2.14 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  11. 3. Extensibility and Reusability - Inheritance at Work
    1. 3.1 Extendibility and Reusability of OOP Paradigm
    2. 3.2 Extending/Deriving New Classes
      1. 3.2.1 Containment: Class within a Class - Container Class
      2. 3.2.2 Inheritance and Class Hierarchy
      3. 3.2.3 Generalization vs Specialization
    3. 3.3 Overriding Base Class Functions
    4. 3.4 Overloading
    5. 3.5 Single and Multiple Inheritances
    6. 3.6 Virtual Inheritance
    7. 3.7 Problems with Multiple Inheritance
    8. 3.8 Interface
    9. 3.9 Access Specifiers in Inheritance
    10. 3.10 Run-time-type Information - RTTI
    11. 3.11 Virtual Functions
    12. 3.12 Pure Virtual Functions
    13. 3.13 Run-time Polymorphism and Dynamic Data Binding
    14. 3.14 Class as Abstract Data Type
    15. 3.15 Separation of Behaviour and Implementation
    16. 3.16 Decoupling
    17. 3.17 Standard Template Library
    18. 3.18 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  12. 4. Dynamic Modelling
    1. 4.1 Introduction to Static and Dynamic Modelling
    2. 4.2 Lifetime of an Object
    3. 4.3 Unified Modelling Language - A Tool for OOAD
      1. 4.3.1 Overview of UML
      2. 4.3.2 Classification of UML Diagrams
    4. 4.4 User Requirements - Use Cases
    5. 4.5 Architecture and Domain: What Are They?
      1. 4.5.1 Architecture
      2. 4.5.2 Domain
    6. 4.6 Sequence Diagram
    7. 4.7 Collaboration (Communication) Diagram
    8. 4.8 Events and State
      1. 4.8.1 Activity/Action and Operations
      2. 4.8.2 Nested State Diagrams
    9. 4.9 Activity Diagram
    10. 4.10 Packages and Components – A Way to Organize Large and Complex Projects
    11. 4.11 Component and Deployment Diagram
    12. 4.12 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  13. 5. Analysis and Design Methodologies
    1. 5.1 Introduction
    2. 5.2 Stages and Methodologies for Systems Development
      1. 5.2.1 Methodologies for Software Development
      2. 5.2.2 Systems Development Life Cycle (SDLC)
    3. 5.3 Structured Analysis and Design (SASD)
      1. 5.3.1 Conceptual Design - Functional Modelling and Data Modelling
      2. 5.3.2 Modular Design
      3. 5.3.3 Analysis and Design Techniques and Tools
      4. 5.3.4 Context Diagrams
      5. 5.3.5 Event List
      6. 5.3.6 Data Flow Diagrams
      7. 5.3.7 Data Dictionary
      8. 5.3.8 Multilevel DFDs
      9. 5.3.9 Entity Relationship Diagram
      10. 5.3.10 Process Specifications
      11. 5.3.11 Specifying Constraints
    4. 5.4 Case Study on Structured Analysis and Design
      1. 5.4.1 Example of Statement of Purpose
      2. 5.4.2 Context Diagram
      3. 5.4.3 Event List
      4. 5.4.4 Data Flow Diagrams
      5. 5.4.5 Data Dictionary
      6. 5.4.6 Entity Relationship Diagrams
      7. 5.4.7 Process Specifications - SSCS
      8. 5.4.8 Structured Analysis and Design – Advantages and Disadvantages
    5. 5.5 Object-oriented Software Analysis and Design (OOAD)
      1. 5.5.1 Different Models for Object Analysis
      2. 5.5.2 Identifying Classes
      3. 5.5.3 Identifying Attributes
      4. 5.5.4 Specifying Operations
      5. 5.5.5 Work Out Associations
    6. 5.6 OOAD: A Case Study
    7. 5.7 Design for Reuse
    8. 5.8 Comparison of SASD and OOAD Methodologies
    9. 5.9 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  14. 6. C++ Fundamentals and Basic Programming
    1. 6.1 Introduction
    2. 6.2 History and Development of Object-oriented Languages like C++
    3. 6.3 Object-oriented Language Features
    4. 6.4 Welcome to C++ Language
      1. 6.4.1 Setting Path
      2. 6.4.2 C++ Program Structure
      3. 6.4.3 C++ Development Environment
    5. 6.5 Further Sample Programs of C++
      1. 6.5.1 Execution of a Program in a Loop
      2. 6.5.2 Arrays Implementation
      3. 6.5.3 Use of Structure to Implement Problem
      4. 6.5.4 Class Implementation
    6. 6.6 Console IO Operations
      1. 6.6.1 Console IO Functions - Commands getchar() and putchar()
      2. 6.6.2 Console IO Functions - Commands gets and puts
      3. 6.6.3 Unformatted Stream IO Functions - get(), put(), getline() and write()
    7. 6.7 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  15. 7. C++ Programming Basics and Control Loops
    1. 7.1 Introduction
    2. 7.2 Declaration of Variables
    3. 7.3 Data Types
    4. 7.4 Declaration and Assignment Values to Variables
    5. 7.5 Expressions
    6. 7.6 Operators
      1. 7.6.1 IO Operators << and >>, iostream objects cin and cout
      2. 7.6.2 Unary Operators
      3. 7.6.3 Size of Operator
      4. 7.6.4 Arithmetic Operators
      5. 7.6.5 Relational and Logical Operators
      6. 7.6.6 Logical Operators
      7. 7.6.7 Conditional Expressions: Question Mark Operator
      8. 7.6.8 Comma Operator
      9. 7.6.9 Bitwise Operators
    7. 7.7 Precedence and Association of Operators
    8. 7.8 Control Loops
      1. 7.8.1 Conditional and Branching Statements
      2. 7.8.2 Switch and Case Statements
      3. 7.8.3 While Loop
      4. 7.8.4 Do-while Loop
      5. 7.8.5 For Loop
      6. 7.8.6 When to Use For or While or Do-while
    9. 7.9 Break and Continue
      1. 7.9.1 Break
      2. 7.9.2 Continue Statement
      3. 7.9.3 Goto Statements
      4. 7.9.4 Exit Function
    10. 7.10 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  16. 8. Functions, Storage Class Preprocessor Directives, and Arrays and Strings
    1. 8.1 Introduction
    2. 8.2 Why Use Function Templates?
    3. 8.3 Call by Value
    4. 8.4 Call by Reference
    5. 8.5 Call by Constant Reference
    6. 8.6 Recursion
    7. 8.7 Inline Functions
    8. 8.8 Function Overloading
    9. 8.9 Default Arguments
    10. 8.10 Memory Management of C++
      1. 8.10.1 Types of Storage Classes
    11. 8.11 Header Files and Standard Libraries
    12. 8.12 C++ Preprocessor
      1. 8.12.1 Macro Expansion
      2. 8.12.2 Macro Definition with Arguments
      3. 8.12.3 File Inclusion
      4. 8.12.4 Conditional Inclusion
      5. 8.12.5 Conditional Compilation #ifdef and #ifndef Statements
      6. 8.12.6 #undef
      7. 8.12.7 #error Macros
    13. 8.13 Arrays
      1. 8.13.1 How are Arrays Stored in the Memory?
      2. 8.13.2 Array Initialization
      3. 8.13.3 Multi-dimensional Arrays
      4. 8.13.4 Character Array - String Handling in C++ Language
    14. 8.14 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  17. 9. Pointers and References
    1. 9.1 Introduction
    2. 9.2 What, Why and How of Pointers
    3. 9.3 Pointers Declaration and Usage
    4. 9.4 Call by Value and Call by Reference (Pointers)
    5. 9.5 Dynamic Memory New and Delete Functions
      1. 9.5.1 Memory Leak
      2. 9.5.2 Dangling Pointer
      3. 9.5.3 Pointers and Arrays
      4. 9.5.4 Pointers and Two-dimensional Arrays
      5. 9.5.5 Array Declaration on Heap Memory
      6. 9.5.6 Pointer to Pointer
      7. 9.5.7 Dynamic Memory for a Two-dimensional Array
      8. 9.5.8 Pointers and Three-dimensional Arrays
      9. 9.5.9 Array of Pointers
      10. 9.5.10 Pointers to Void
      11. 9.5.11 Pointer to a Constant vs const Pointer
      12. 9.5.12 Pointers to Function
    6. 9.6 What, Why and How of References
      1. 9.6.1 Which is Better - Pointer or Reference?
    7. 9.7 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Solutions to Objective Questions
  18. 10. Classes
    1. 10.1 Introduction
    2. 10.2 Classes and Objects
      1. 10.2.1 How to Create an Object to a Class?
      2. 10.2.2 How to Access Member Data and Member Functions?
      3. 10.2.3 Constructors and Destructors
    3. 10.3 Friend Function
    4. 10.4 Class Within a Class: Container Class
    5. 10.5 Objects and Data Members on Heap Memory
    6. 10.6 This Pointer
    7. 10.7 Pointers vs Objects: Use of Constant Declarations
    8. 10.8 Passing of Objects by Reference and Pointers to a Function
    9. 10.9 Constant Pointers and Constant References
    10. 10.10 Static Member Data
    11. 10.11 Static Member Functions
    12. 10.12 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Solutions to Objective Questions
  19. 11. C++ Special Features: Errors and Exceptions and Operator Overloading
    1. 11.1 Introduction
    2. 11.2 Errors and Exceptions
    3. 11.3 Try and Catch Blocks
    4. 11.4 Exception Classes
    5. 11.5 Stack Data Structure
    6. 11.6 Operator Overloading
      1. 11.6.1 Overloading of + Operator and * Operator
      2. 11.6.2 Operator << Overloading
      3. 11.6.3 What We Can Overload and What We Cannot Overload
      4. 11.6.4 Overloading Assignment Operator =
    7. 11.7 Pre- and Post-increment Operator Overloading
    8. 11.8 Overloading Operators New and Delete
    9. 11.9 Conversion (Casting) Operators
    10. 11.10 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  20. 12. Inheritance
    1. 12.1 Introduction
    2. 12.2 Inheritance Hierarchy
    3. 12.3 Types of Inheritance
    4. 12.4 Constructors and Destructors
    5. 12.5 Base Class Function Overriding
    6. 12.6 Base Class Function Hiding
    7. 12.7 Virtual Functions
    8. 12.8 Multiple Virtual Functions
    9. 12.9 Virtual Destructors: Why and How?
    10. 12.10 Hybrid Inheritance with Multiple Inheritances
    11. 12.11 Virtual Inheritance
    12. 12.12 Run-time Polymorphism and Dynamic Binding
    13. 12.13 Abstract Data Types (ADTs)
    14. 12.14 Pure Virtual Functions
    15. 12.15 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  21. 13. IO Streaming
    1. 13.1 Introduction
    2. 13.2 IO Streaming
    3. 13.3 IO Library Files Classification
      1. 13.3.1 Formatted IO
      2. 13.3.2 Unformatted IO
      3. 13.3.3 IO Stream State
      4. 13.3.4 IO Stream Library - Header Files
    4. 13.4 IO Manipulators
    5. 13.5 Flags
    6. 13.6 File I/O
      1. 13.6.1 File Types
      2. 13.6.2 Stream Operating Modes
    7. 13.7 Binary File
    8. 13.8 Seekg()/Seekp() and Tellg() and Tellp() Functionality of C++
    9. 13.9 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  22. 14. Generic Programming and Templates
    1. 14.1 Introduction
    2. 14.2 What is Generic Programming and Why Use Templates?
    3. 14.3 Template Classes
    4. 14.4 Function Templates and Passing of Arguments to a Function
    5. 14.5 Template Friends
      1. 14.5.1 Non-template Function
      2. 14.5.2 Template Friend Class or Function
      3. 14.5.3 Type-specific Friend Function in Class Templates
    6. 14.6 Templates and Static Member Functions and Member Data
    7. 14.7 Template Exceptions
    8. 14.8 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  23. 15. Object-oriented Programming with Java
    1. 15.1 Introduction
    2. 15.2 Internet and the World Wide Web
    3. 15.3 C and C++ are Around - Then Why Java?
    4. 15.4 Java Story
    5. 15.5 Java Features
      1. 15.5.1 Portability or Platform Independent
      2. 15.5.2 Automatic Garbage Collection
      3. 15.5.3 Object-oriented Features
      4. 15.5.4 Easy to Learn and Excellent Documentation
      5. 15.5.5 Byte Code
      6. 15.5.6 Java Virtual Machine (JVM)
      7. 15.5.7 Comparison with C++
    6. 15.6 Developing First Java Application
      1. 15.6.1 Installing and Using Java Development Kit
      2. 15.6.2 Setting Path and Classpath
      3. 15.6.3 Java Program Structure
      4. 15.6.4 Java Documentation Comments
      5. 15.6.5 Java Development Environment
      6. 15.6.6 Our First Java Application
      7. 15.6.7 Application with Swing Components
      8. 15.6.8 Eclipse-integrated Development Environment
      9. 15.6.9 Command Line Arguments
    7. 15.7 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  24. 16. Java Fundamentals and Control Loops
    1. 16.1 Introduction
    2. 16.2 Constants/Literal Constants
      1. 16.2.1 Integer Constants
      2. 16.2.2 Floating Point Constants/Real Constants
      3. 16.2.3 Character Constants
      4. 16.2.4 String Constants
      5. 16.2.5 Backlash Character Strings
      6. 16.2.6 Boolean Literals
      7. 16.2.7 Symbolic Constants
    3. 16.3 Variables and Assignment of Values to Variables
    4. 16.4 Data Types
      1. 16.4.1 Integer Data Types
      2. 16.4.2 Floating Point Data Types
      3. 16.4.3 Character Type
      4. 16.4.4 Boolean Data Type
    5. 16.5 Scope and Life Time of Variables
    6. 16.6 Arithmetic Operators
    7. 16.7 Type Conversion and Type Casting
      1. 16.7.1 Type Conversion
      2. 16.7.2 Type Cast
    8. 16.8 Unary Operators
      1. 16.8.1 Increment and Decrement Operators
      2. 16.8.2 Assignment Operator
      3. 16.8.3 Chained Assignment
      4. 16.8.4 Relational Operators
    9. 16.9 Logical Operators
    10. 16.10 Bit-wise Operators
    11. 16.11 Other Operators
      1. 16.11.1 Question Mark (?) Operator Conditional Expressions
      2. 16.11.2 Member Operator or Dot Operator
      3. 16.11.3 Instanceof Operator
      4. 16.11.4 New Operator
      5. 16.11.5 Operator Precedence and Associativity
    12. 16.12 Conditional and Branching Statements
      1. 16.12.1 If and If-Else Statements
      2. 16.12.2 Nested If Statements
      3. 16.12.3 If-Else-If Ladder
      4. 16.12.4 Switch and Case Statements
    13. 16.13 Control Loops
      1. 16.13.1 While Loop
      2. 16.13.2 Do-while Loop
      3. 16.13.3 For Loop
    14. 16.14 Break
    15. 16.15 Continue Statement
    16. 16.16 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  25. 17. Simple IO and Arrays and Strings Vectors
    1. 17.1 Introduction
    2. 17.2 Input from Keyboard
      1. 17.2.1 System.in, System.out and System.err Commands
      2. 17.2.2 StringTokenizer to Receive Multiple Inputs in a Single Line
      3. 17.2.3 Obtaining Inputs Using Java's Scanner Class
      4. 17.2.4 Using Control Formats - System.out.printf()
      5. 17.2.5 Formatted Output with String Format
    3. 17.3 Arrays
      1. 17.3.1 Declaring and Creation of an Array
      2. 17.3.2 Initialization of Arrays
      3. 17.3.3 How Are Arrays Stored in the Memory?
      4. 17.3.4 Accessing and Modifying Array Elements
      5. 17.3.5 Passing Arrays as Arguments to Methods
      6. 17.3.6 Returning Arrays as Arguments to Methods
      7. 17.3.7 Multi-dimensional Arrays
      8. 17.3.8 Java.util. Arrays Class
    4. 17.4 String
      1. 17.4.1 Array of Strings
      2. 17.4.2 String Class Methods
      3. 17.4.3 StringBuffer Class
      4. 17.4.4 StringBuilder Class
    5. 17.5 Collection Framework
      1. 17.5.1 Vector Class
      2. 17.5.2 Vector Methods
    6. 17.6 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  26. 18. Class Objects and Methods
    1. 18.1 Introduction
    2. 18.2 Classes and Objects
    3. 18.3 Declaring a Class and Creating of Instances of Class Variables
    4. 18.4 Constructors
      1. 18.4.1 Default Constructor
      2. 18.4.2 Parameterized Constructor and Overloading of Constructors
    5. 18.5 Specifying Private Access Specifiers and Use of Public Methods
      1. 18.5.1 Private Access Specifiers
      2. 18.5.2 Methods
      3. 18.5.3 Math Class of Java
      4. 18.5.4 Call by Value and Call by Reference
      5. 18.5.5 Passing and Returning of Objects To and From Methods
      6. 18.5.6 Method Overloading
    6. 18.6 Usage of this Keyword
    7. 18.7 Garbage Collection
    8. 18.8 Finalizer and Finalize() Methods
    9. 18.9 Final Variable
    10. 18.10 Access Control and Accessing Class Members
    11. 18.11 Static Members
    12. 18.12 Factory Methods
    13. 18.13 Nested Classes
    14. 18.14 Inner Classes
    15. 18.15 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  27. 19. Inheritance: Packages: Interfaces
    1. 19.1 Introduction
    2. 19.2 Basic Concepts of Inheritance
    3. 19.3 Member Access Rules
    4. 19.4 Using Super Class
    5. 19.5 Methods Overriding
    6. 19.6 Multilevel Inheritance
    7. 19.7 Run-time Polymorphism
    8. 19.8 Abstract Classes
    9. 19.9 Using Final with Inheritance
      1. 19.9.1 Final Method
      2. 19.9.2 Final Classes
    10. 19.10 Object Class
    11. 19.11 Packages
      1. 19.11.1 Reusable Classes
    12. 19.12 Path and Classpath
    13. 19.13 Importing of Packages
    14. 19.14 Access Specifiers Revisited for Packages
    15. 19.15 Interfaces
      1. 19.15.1 What and Why of Interfaces
      2. 19.15.2 Defining and Implementing Interfaces
    16. 19.16 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  28. 20. Errors and Exceptions in Java and Multithreaded Programming
    1. 20.1 Introduction
    2. 20.2 Errors and Exceptions
      1. 20.2.1 Errors
      2. 20.2.2 Exceptions
    3. 20.3 Try and Catch Blocks
    4. 20.4 Handling of Multiple Exceptions by Try and Catch Blocks
    5. 20.5 Using Finally Block
    6. 20.6 Throw Exceptions
    7. 20.7 Throws Exceptions
    8. 20.8 Re-throwing of an Exception
    9. 20.9 Defining Our Own Exception
      1. 20.9.1 Procedure for Throwing Our Own Exceptions
    10. 20.10 Concepts of Multithreading
      1. 20.10.1 Multithreaded Program
    11. 20.11 Process vs Threads
      1. 20.11.1 Process
      2. 20.11.2 Threads
    12. 20.12 How to Create and Run the Threads?
      1. 20.12.1 Which is Better: Extends Thread or Implements Runnable?
      2. 20.12.2 Use of isAlive() and join() Methods
    13. 20.13 Life Cycle of Thread
    14. 20.14 Thread Priorities
    15. 20.15 Synchronization
    16. 20.16 Inter-thread Communications
    17. 20.17 Deadlock in Multithreaded Programming
    18. 20.18 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  29. 21. Java IO Files
    1. 21.1 Introduction
    2. 21.2 IO Streaming
    3. 21.3 Java IO Stream Classes
      1. 21.3.1 Classification of ByteStream Classes
      2. 21.3.2 Classification of CharacterStream Classes or Text Classes
      3. 21.3.3 DataInput and DataOutputStream FileInput and FileOutputStream
      4. 21.3.4 FileReader and FileWriter
    4. 21.4 IO Errors and Exceptions
    5. 21.5 FilterInputStream and FilterOutputStreams
    6. 21.6 Using BufferedInput and BufferedOutput Streams
    7. 21.7 Writing Primitive Data Types to File: DataInputStream/DataOutputStream
    8. 21.8 File Class
    9. 21.9 Random Access Files
    10. 21.10 Serialization of Objects and Object Streams
      1. 21.10.1 Serialization
      2. 21.10.2 De-serialization
    11. 21.11 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  30. 22. Networking in Java
    1. 22.1 Introduction
    2. 22.2 Basics of Networking
      1. 22.2.1 TCP/IP
      2. 22.2.2 User Data Gram Protocol (UDP)
    3. 22.3 Internet Address
    4. 22.4 URL and URL Connection
      1. 22.4.1 URL Connection
    5. 22.5 TCP/IP Sockets
      1. 22.5.1 ServerSocket Class
      2. 22.5.2 Server and Socket for Communications: How to Set them to Work?
      3. 22.5.3 Client and Socket for Communications: How to Set them to Work?
    6. 22.6 Client Server Program
      1. 22.6.1 Client Server Two-way Communication Program
      2. 22.6.2 Multiple Clients and Server Programs Using Multithreads
      3. 22.6.3 Client Server Program for File Download from Server
    7. 22.7 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  31. 23. Graphics Using Swing Components and Applets
    1. 23.1 Graphics Programming and Applets Introduction
    2. 23.2 Hierarchy of Graphics Software
    3. 23.3 Containers in Swing
      1. 23.3.1 JFrame Class
      2. 23.3.2 JPanel Class
    4. 23.4 Display Widgets in Swing
      1. 23.4.1 JLabel Class
      2. 23.4.2 JButton
      3. 23.4.3 JCheckBox
      4. 23.4.4 JComboBox
      5. 23.4.5 JMenu Class
    5. 23.5 Layout Managers
      1. 23.5.1 Border Layout
      2. 23.5.2 Grid Layout
      3. 23.5.3 Flow Layout
    6. 23.6 Event Types and Event Listeners
      1. 23.6.1 Action Event Listener
      2. 23.6.2 Item Event Listener
      3. 23.6.3 Keyboard Event Listener
      4. 23.6.4 Mouse Event Listener
    7. 23.7 Applets
      1. 23.7.1 Concepts of Applets
      2. 23.7.2 Life Cycle of an Applet
      3. 23.7.3 Creating an Applet - HelloWorld Applet
      4. 23.7.4 JApplets - Applets with Swing Components: Better Look and Feel
      5. 23.7.5 Applets vs. Stand-alone Applications
      6. 23.7.6 Passing Arguments to Applets
    8. 23.8 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  32. 24. Collections and Software Development Using Java
    1. 24.1 Introduction
    2. 24.2 Collection Framework of Java
    3. 24.3 Collection Interface
    4. 24.4 Set Interface
    5. 24.5 Iterators
    6. 24.6 List Interface
    7. 24.7 Collection Algorithms
    8. 24.8 Map Interface
    9. 24.9 Collection View of Map
    10. 24.10 JDBC Database Connectivity
    11. 24.11 Access Database Records Using MS Access Database
    12. 24.12 Access Database Records Using MySql Open Source Database
    13. 24.13 Access Database Records Using Oracle Database
    14. 24.14 Prepared Statement and Callable Statements
      1. 24.14.1 PreparedStatement
      2. 24.14.2 Callable Statements
    15. 24.15 Servlets
      1. 24.15.1 Servlets API and javax.servlet Package
      2. 24.15.2 HttpServletRequest
      3. 24.15.3 HttpServletResponse
      4. 24.15.4 HttpServlet Class-Get Request with Data from Client
      5. 24.15.5 HTTP Post Requests
    16. 24.16 Java Beans
    17. 24.17 Summary
      1. Exercise Questions
        1. Objective Questions
        2. Short-answer Questions
        3. Long-answer Questions
        4. Assignment Questions
        5. Solutions to Objective Questions
  33. Appendix A
  34. Appendix B
  35. Appendix C
  36. Acknowledgements
  37. Copyright

Product information

  • Title: Object-oriented Programming Using C++ and Java
  • Author(s): Ramesh Vasappanavara, Gautam Vasappanavara, Anand Vasappanavara
  • Release date: May 2011
  • Publisher(s): Pearson India
  • ISBN: 9788131754559