Object Oriented Programming Through Java by Pearson

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. Exhaustively covering the BTech, MCAs and other PG course syllabi of all Indian universities, it explains the underlying OOP theory with diagrams and implementation examples in C++ and Java, as well as advanced topics in C++ and Java such as templates, generic programming and collection framework of Java. Object-oriented features with UML and their seamless integration with OOP languages, C++ and Java are covered in detail and a separate chapter is devoted to analysis and design. The book's self-learning and practice-oriented approach will be especially helpful to self-taught readers and engineering professionals at work will also benefit greatly from its discussions of object-oriented analysis and design case studies and its easy integration with a modeling tool such as UML.

About The Authors –

Ramesh Vasappanavara obtained his bachelor’s degree from the University College of Engineering, Andhra University (1972–1977) and master’s degree from Indian Institute of Technology Kharagpur (1982–1984). He obtained his Ph.D. in Computer Science and Engineering from Jawaharlal Nehru Technological University, Hyderabad. He has held several senior appointments in Naval R&D, and was a Professor and Director of reputed engineering schools such as Gayatri Vidya Parishad College of Engineering; Godavari Institute of Engineering Technology, Rajahmundry; Galgotia College of Engineering, Delhi, and Indo-German Institute of Advanced Technology. At present he is working as Director and Professor in SGIT, Delhi, a prestigious engineering school. His professional interests include grid computing, algorithms and embedded systems. His passion is to develop young minds into original thinkers who can then provide innovative solutions to real-world problems. He can be reached on ramesh.vasappanavara@gmail.com.

Anand Vasappanavara obtained his bachelor’s degree from the Indian Institute of Technology Madras (1999–2003) and his master’s degree from Indian Institute of Science, Bangalore (2005–2007). He has worked for Tata Motors, Pune, as a design engineer between 2003 and 2005, wherein he developed a controller for a hybrid car for TELCO. He presently works for Shell, an oil and gas company as a Process Control Technologist ever since 2007. His professional interests broadly include energy, automobiles and control systems. He envisions a world where energy and knowledge are available in abundance, which can result in real empowerment of the people. He can be reached on vasappanavara@gmail.com.

Gautam Vasappanavara obtained his bachelor’s degree from the University College of Engineering, Andhra University (2000–2004) and his master’s degree in embedded systems from Birla Institute of Technology and Science, Pilani (2005–2007) as Phillips Research Scholar. He has worked for GE Controls, Hyderabad, and Samsung Electronics, Bangalore, as Lead Engineer in Wireless technologies. Presently he is on a sabbatical as he is pursuing a management degree from Indian School of Business, Hyderabad. His passions include energy conservation, using technology as a platform for societal transformations and knowledge sharing. He can be reached on gautam.vasappanavara@gmail.com.

Table of contents

  1. Cover
  2. About the Authors
  3. Brief Contents
  4. Contents (1/2)
  5. Contents (2/2)
  6. Preface
  7. How to Use this Book and Web Resources
  8. Roadmap to the Syllabus
  9. Chapter 1: Basics of Object-Oriented Programming
    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 Need for Object-oriented Programming Paradigm
    4. 1.4 A Way of Looking at the World: Problem-solving Approach of OOP Paradigm
      1. 1.4.1 Agents
      2. 1.4.2 Community
    5. 1.5 Elements in Object-oriented Paradigm
      1. 1.5.1 Elements of OOP: Objects
      2. 1.5.2 Elements of OOP: Messages
      3. 1.5.3 Information Hiding
      4. 1.5.4 Elements of OOP: Recursive Design
      5. 1.5.5 Elements of OOP: Classes
      6. 1.5.6 Elements of OOP: Methods and Responsibilities
      7. 1.5.7 Elements of OOP: Encapsulation
      8. 1.5.8 Elements of OOP: Data Hiding/Data Abstraction
      9. 1.5.9 Elements of OOP: Methods Overloading
    6. 1.6 Elements of OOP: Extendibility and Reusability of OOP Paradigm
      1. 1.6.1 Extending/Deriving New Classes
      2. 1.6.2 Nested Class/Container Class/Inner Class
      3. 1.6.3 Inheritance Hierarchy
      4. 1.6.4 Types of Inheritances
      5. 1.6.5 Methods Overriding vs Methods Overloading
      6. 1.6.6 Element of OOP: Polymorphism
      7. 1.6.7 Methods Binding
    7. 1.7 Coping with Complexities
      1. 1.7.1 Run-time Polymorphism and Dynamic Data Binding
      2. 1.7.2 Class as Abstract Data Type (ADT)
      3. 1.7.3 Concrete Class
      4. 1.7.4 Interface
    8. 1.8 Errors and Exceptions
      1. 1.8.1 Errors
      2. 1.8.2 Exceptions
      3. 1.8.3 Try and Catch Blocks
      4. 1.8.4 Using Finally() Block
      5. 1.8.5 Throw Exceptions
      6. 1.8.6 Defining Our Own Exception
    9. 1.9 Generic Programming
    10. 1.10 OOP–Object-oriented Analysis and Design (OOAD)
      1. 1.10.1 OO Analysis and Design (OOAD)
    11. 1.11 Summary of OOP Concepts
    12. 1.12 Key Points
    13. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Solutions to Objective Questions
  10. Chapter 2: Object-oriented Programming with java
    1. 2.1 Introduction
    2. 2.2 Internet and the World Wide Web
    3. 2.3 C and C++ are Around – Then Why Java?
    4. 2.4 Java Story
    5. 2.5 Java Features
      1. 2.5.1 Portability or Platform Independent
      2. 2.5.2 Automatic Garbage Collection
      3. 2.5.3 Object-oriented Features
      4. 2.5.4 Easy to Learn and Excellent Documentation
      5. 2.5.5 Byte Code
      6. 2.5.6 Java Virtual Machine (JVM)
      7. 2.5.7 Comparison with C++
    6. 2.6 Developing First Java Application
      1. 2.6.1 Installing and Using Java Development Kit
      2. 2.6.2 Setting Path and Classpath
      3. 2.6.3 Java Program Structure
      4. 2.6.4 Java Documentation Comments
      5. 2.6.5 Java Development Environment
      6. 2.6.6 Our First Java Application
      7. 2.6.7 Application with Swing Components
      8. 2.6.8 Eclipse-integrated Development Environment
      9. 2.6.9 Command Line Arguments
    7. 2.7 Key Points
    8. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  11. Chapter 3: Java Basics and Control Loops
    1. 3.1 Introduction
    2. 3.2 Constants/Literal Constants
      1. 3.2.1 Integer Constants
      2. 3.2.2 Floating Point Constants/Real Constants
      3. 3.2.3 Character Constants
      4. 3.2.4 String Constants
      5. 3.2.5 Backlash Character Strings
      6. 3.2.6 Boolean Literals
      7. 3.2.7 Symbolic Constants
    3. 3.3 Variables and Assignment of Values to Variables
    4. 3.4 Data Types
      1. 3.4.1 Integer Data Types
      2. 3.4.2 Floating Point Data Types
      3. 3.4.3 Character Type
      4. 3.4.4 Boolean Data Type
    5. 3.5 Scope and Life Time of Variables
    6. 3.6 Arithmetic Operators
    7. 3.7 Type Conversion and Type Casting
      1. 3.7.1 Type Conversion
      2. 3.7.2 Type Cast
    8. 3.8 Unary Operators
      1. 3.8.1 Increment and Decrement Operators
      2. 3.8.2 Assignment Operator
      3. 3.8.3 Chained Assignment
      4. 3.8.4 Relational Operators
    9. 3.9 Logical Operators
    10. 3.10 Bit-wise Operators
    11. 3.11 Other Operators
      1. 3.11.1 Question Mark (?) Operator Conditional Expressions
      2. 3.11.2 Member Operator or Dot Operator
      3. 3.11.3 Instanceof Operator
      4. 3.11.4 New Operator
      5. 3.11.5 Operator Precedence and Associativity
    12. 3.12 Conditional and Branching Statements
      1. 3.12.1 If and If–Else Statements
      2. 3.12.2 Nested If Statements
      3. 3.12.3 If–Else–If Ladder
      4. 3.12.4 Switch and Case Statements
    13. 3.13 Control Loops
      1. 3.13.1 While Loop
      2. 3.13.2 Do-while Loop
      3. 3.13.3 For Loop
    14. 3.14 Break
    15. 3.15 Continue Statement
    16. 3.16 Key Points
    17. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  12. Chapter 4: Simple IO and Arrays and String Vectors
    1. 4.1 Introduction
    2. 4.2 Input from Keyboard
      1. 4.2.1 System.in, System.out and System.err Commands
      2. 4.2.2 StringTokenizer to Receive Multiple Inputs in a Single Line
      3. 4.2.3 Obtaining Inputs Using Java’s Scanner Class
      4. 4.2.4 Using Control Formats – System.out.printf ()
      5. 4.2.5 Formatted Output with String Format
    3. 4.3 Arrays
      1. 4.3.1 Declaring and Creation of an Array
      2. 4.3.2 Initialization of Arrays
      3. 4.3.3 How Are Arrays Stored in the Memory?
      4. 4.3.4 Accessing and Modifying Array Elements
      5. 4.3.5 Passing Arrays as Arguments to Methods
      6. 4.3.6 Returning Arrays as Arguments to Methods
      7. 4.3.7 Multi-dimensional Arrays
      8. 4.3.8 Java. util. Arrays Class
    4. 4.4 String
      1. 4.4.1 Array of Strings
      2. 4.4.2 String Class Methods
      3. 4.4.3 StringBuffer Class
      4. 4.4.4 StringBuilder Class
    5. 4.5 Collection Framework
      1. 4.5.1 Vector Class
      2. 4.5.2 Vector Methods
    6. 4.6 Key Points
    7. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  13. Chapter 5: Class Objects and Methods
    1. 5.1 Introduction
    2. 5.2 Classes and Objects
    3. 5.3 Declaring a Class and Creating of Instances of Class Variables
    4. 5.4 Constructors
      1. 5.4.1 Default Constructor
      2. 5.4.2 Parameterized Constructor and Overloading of Constructors
    5. 5.5 Specifying Private Access Specifiers and Use of Public Methods
      1. 5.5.1 Private Access Specifiers
      2. 5.5.2 Methods
      3. 5.5.3 Math Class of Java
      4. 5.5.4 Call by Value and Call by Reference
      5. 5.5.5 Passing and Returning of Objects To and From Methods
      6. 5.5.6 Method Overloading
      7. 5.5.7 Recursion
    6. 5.6 Usage of this Keyword
    7. 5.7 Garbage Collection
    8. 5.8 Finalizer and Finalize () Methods
    9. 5.9 Final Variable
    10. 5.10 Access Control and Accessing Class Members
    11. 5.11 Static Members
    12. 5.12 Factory Methods
    13. 5.13 Nested Classes
    14. 5.14 Inner Classes
    15. 5.15 Key Points
    16. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  14. Chapter 6: Inheritance: Packages: Interfaces
    1. 6.1 Introduction
    2. 6.2 Basic Concepts of Inheritance
      1. 6.2.1 Base Class/Super Class
      2. 6.2.2 Subclass or Derived Classes
      3. 6.2.3 Forms of Inheritance
    3. 6.3 Member Access Rules
    4. 6.4 Using Super Class: Uses of Super Class
    5. 6.5 Types of Inheritance
      1. 6.5.1 Single Inheritance
      2. 6.5.2 Multilevel Inheritance
      3. 6.5.3 Hierarchical Inheritance
      4. 6.5.4 Multiple Inheritance
    6. 6.6 Methods Overriding
    7. 6.7 Run-time Polymorphism
    8. 6.8 Abstract Classes
    9. 6.9 Using Final with Inheritance
      1. 6.9.1 Final Method
      2. 6.9.2 Final Classes
    10. 6.10 Object Class
    11. 6.11 Packages
      1. 6.11.1 Reusable Classes
    12. 6.12 Path and Classpath
    13. 6.13 Importing of Packages
    14. 6.14 Access Specifiers Revisited for Packages
    15. 6.15 Interfaces
      1. 6.15.1 What and Why of Interfaces
      2. 6.15.2 Differences between Classes and Interfaces
      3. 6.15.3 Variables and Methods in Interfaces
      4. 6.15.4 Extending Interfaces
      5. 16.5.5 Subtype
    16. 6.16 Benefits of Inheritance: Costs of Inheritance
    17. 6.17 Key Points
    18. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  15. Chapter 7: Errors and Exceptions in Java and Multithreaded Programming
    1. 7.1 Introduction
    2. 7.2 Errors and Exceptions
    3. 7.3 Termination or Presumptive/Resumption Models
    4. 7.4 Types of Exceptions
      1. 7.4.1 Run-time Exception: Synchronous Exceptions
      2. 7.4.2 Run-time Exception: Asynchronous Exceptions
      3. 7.4.3 Compile Time Exception: Checked Exceptions
      4. 7.4.4 Compile Time Exception: Unchecked Exceptions
      5. 7.4.5 Exception Hierarchy
      6. 7.4.6 Benefits of Exception Handling
    5. 7.5 Usage of Try and Catch Blocks: Exception Handling Mechanism
    6. 7.6 Handling of Multiple Exceptions by Try and Catch Blocks
    7. 7.7 Throw, Throws and Finally Keywords
      1. 7.7.1 Using Finally Block
      2. 7.7.2 Throw Exceptions
      3. 7.7.3 Throws Exceptions
      4. 7.7.4 Re-throwing of an Exception
      5. 7.7.5 Built-in Exceptions
    8. 7.8 Creating own exception subclasses
      1. 7.8.1 Procedure for Throwing Our Own Exceptions
    9. 7.9 Concepts of Multithreading
    10. 7.10 Process vs Threads
      1. 7.10.1 Process
      2. 7.10.2 Threads
    11. 7.11 Differences between Multithreading and Multitasking
    12. 7.12 Life Cycle of Thread
    13. 7.13 How to Create and Run the Threads?
      1. 7.13.1 Which is Better—Extends Thread or Implements Runnable?
      2. 7.13.2 Use of isAlive () and join () methods
    14. 7.14 Thread Priorities
    15. 7.15 Synchronization
    16. 7.16 Inter-thread Communications
    17. 7.17 Daemon Threads
    18. 7.18 Deadlock in Multithreaded Programming
    19. 7.19 Thread Groups
    20. 7.20 Key Points
    21. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  16. Chapter 8: Applets and Event Handling
    1. 8.1 Applets and Event Handling: An Introduction
    2. 8.2 Applets
      1. 8.2.1 Concepts of Applets
      2. 8.2.2 Life Cycle of an Applet
      3. 8.2.3 Types of Applets
      4. 8.2.4 Creating an Applet—HelloWorldApplet
      5. 8.2.5 JApplets—Applets with Java Swing Components: Better Look and Feel
      6. 8.2.6 Differences between Applets and Application
      7. 8.2.7 Passing Parameters to Applets
      8. 8.2.8 Applet-to-Applet Communication
      9. 8.2.9 Secured Applets
    3. 8.3 Hierarchy of Graphics Software
      1. 8.3.1 Delegation Event Model
      2. 8.3.2 Action Event Listener
      3. 8.3.3 Item Event Listener
      4. 8.3.4 Handling Keyboard Events
      5. 8.3.5 Handling Mouse Events
    4. 8.4 Adapter Class
    5. 8.5 Inner Classes and Uses
    6. 8.6 Key Points
    7. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  17. Chapter 9: Graphics Using AWT Controls
    1. 9.1 AWT: An Introduction
    2. 9.2 AWT Class Hierarchy
      1. 9.2.1 Component
      2. 9.2.2 Container and Panel
    3. 9.3 AWT User Interface Components
      1. 9.3.1 Labels and TextFields and Text Areas
      2. 9.3.2 Buttons
      3. 9.3.3 Canvas
      4. 9.3.4 Scrollbars
      5. 9.3.5 Check Boxes
      6. 9.3.6 Check Box Groups
      7. 9.3.7 Choice and Choice Lists
      8. 9.3.8 Lists
      9. 9.3.9 Scrollpane
      10. 9.3.10 Dialogs
      11. 9.3.11 Menubars and Menus
      12. 9. 3.12 Graphics
      13. 9.3.13 Layout Managers (1/2)
      14. 9.3.13 Layout Managers (2/2)
    4. 9.4 Limitations of AWT
    5. 9.5 Key Points
    6. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  18. Chapter 10: Graphics Using Swing Components
    1. 10.1 GUI Using Swing Components: Introduction
    2. 10.2 MVC (Model View and Control) Architecture
    3. 10.3 Hierarchy of Graphics Software
    4. 10.4 Containers Hierarchy
    5. 10.5 Exploring the Swing Components
      1. 10.5.1 JApplets
      2. 10.5.2 JFrame Class: Creating Frames Using Swing Components
      3. 10.5.3 JPanel Class
    6. 10.6 Display Text and Images in Java Graphics
      1. 10.6.1 Display Text: JLabel Class
      2. 10.6.2 Icons
      3. 10.6.3 JText Field: JText Area
      4. 10.6.4 JButton
      5. 10.6.5 JCheckBox
      6. 10.6.6 JComboBox
      7. 10.6.7 Radio Buttons
    7. 10.7 Tabbed Panes
    8. 10.8 Scroll Panes
    9. 10.9 Trees
    10. 10.10 Tables
    11. 10.11 Key Points
    12. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  19. Chapter 11: Networking in Java
    1. 11.1 Introduction
    2. 11.2 Basics of Networking
      1. 11.2.1 TCP/IP Protocol
      2. 11.2.2 User Data Gram Protocol (UDP)
      3. 11.2.3 Networking Classes and Interfaces
    3. 11.3 Internet Address
    4. 11.4 URL and URL Connection
      1. 11.4.1 URL Connection
    5. 11.5 TCP/IP Sockets
      1. 11.5.1 ServerSocket Class
      2. 11.5.2 Server and Socket for Communications: How to Set Them for Work?
      3. 11.5.3 Client and Socket for Communications: How to Set Them for Work?
    6. 11.6 Client–Server Program
      1. 11.6.1 Client–Server: A Two-Way Communication Program
      2. 11.6.2 Multiple Client–Server Programs Using Multithreads
      3. 11.6.3 Client–Server Program for File Download from Server
    7. 11.7 Java Util Package
      1. 11.7.1 Utility Classes of java.util Package
      2. 11.7.2 Collection Framework of Java
      3. 11.7.3 Collection Interface
      4. 11.7.4 Set Interface
      5. 11.7.5 Iterators
      6. 11.7.6 List Interface
    8. 11.8 Key Points
    9. Exercise Questions
      1. Objective Questions
      2. Short-answer Questions
      3. Long-answer Questions
      4. Assignment Questions
      5. Solutions to Objective Questions
  20. Appendix A: ASCII Table
  21. Appendix B: Number Systems
  22. Appendix C: NetBeans IDE
  23. Model Question Papers (1/2)
  24. Model Question Papers (2/2)
  25. Index

Product information

  • Title: Object Oriented Programming Through Java by Pearson
  • Author(s): Ramesh Vasappanavara, Anand Vasappanavara, Gautam Vasappanavara
  • Release date: May 2024
  • Publisher(s): Pearson India
  • ISBN: 9781299445253