Java Programming, 1st Edition by Pearson

Book description

This book approaches the art of programming using Java with a simplified treatment and succinct presentation of concepts and software development practices for solving problems. All chapters of the book are supported with a wide variety of solved examples and end-of-exercises.

Book Contents –
Part I Java Basics –

1: Java Data Types,Operators and Console I/O Statements
2: Java Conditional and Looping Statements
3: Arrays in Java
4: Methods in Java

Part II Object Oriented Java Programming –

5: Classes and Objects
6: Inheritance and Polymorphism
7: More on Objects and Exceptions

Part III Java Containers for Holding Objects –

8: Sequence Containers
9: Map Containers
10: Set Containers
11: Sorting and Searching

Part IV Java Threads and IO Streams –

12: Concurrency Using Threads
13: Processing Byte and Object Streams
14: Processing Character Streams and NIO

Part V Java GUI Programming –

15: Graphics Programming
16: GUI Development Using JFrame
17: GUI Development Using JApplet

Appendix A
Appendix B
Appendix C
Index

Table of contents

  1. Cover (1/2)
  2. Cover (2/2)
  3. Brief Contents
  4. Contents (1/3)
  5. Contents (2/3)
  6. Contents (3/3)
  7. Pedagogical Features
  8. Preface
  9. Part I Java Basics
  10. Chapter 1: Java Data Types,Operators and Console I/O Statements
    1. 1.1 Introduction
    2. 1.2 Java, World Wide Web and Sensor Devices
    3. 1.3 Java Editing Environments
    4. 1.4 Data types and Variables
    5. 1.5 Constants in Java
    6. 1.6 Java Operators
    7. 1.7 Type Casting and Boxing
    8. 1.8 Console I/O Statements
      1. 1.8.1 Command Line
      2. 1.8.2 Scanner
      3. 1.8.3 BufferedReader
      4. 1.8.4 DataInputStream
      5. 1.8.5 Console
    9. 1.9 Summary
    10. Key Terms
    11. Review Questions
    12. Exercises
  11. Chapter 2: Java Conditional and Looping Statements
    1. 2.1 Introduction
    2. 2.2 Conditional Statements
      1. 2.2.1 if Statement
      2. 2.2.2 Problem: Finding Biggest of Three Integers
      3. 2.2.3 if-else Statement
      4. 2.2.4 if-else-if Statement
      5. 2.2.5 Nested if Statement
      6. 2.2.6 Problem: Checking Leap Year
      7. 2.2.7 Multipoint Switch Statement
      8. 2.2.8 String Cases for Switch
    3. 2.3 Java Loping Statements
      1. 2.3.1 while Loop
      2. 2.3.2 do-while Loop
      3. 2.3.3 for Loop
      4. 2.3.4 Problem: Generating Multiplication Table
      5. 2.3.5 break, continue and assert Statements
    4. 2.4 Summary
    5. Key Terms
    6. Review Questions
    7. Exercises
  12. Chapter 3: Arrays in Java
    1. 3.1 Introduction
    2. 3.2 Declaring and Initializing Arrays
    3. 3.3 Accessing Array Elements
    4. 3.4 Problem: Sequential Search for a Key
    5. 3.5 Problem: Binary Search for a Key
    6. 3.6 The For-Each Statement
    7. 3.7 Problem: Finding Euclidean Distance Between Two Vectors
    8. 3.8 Problem: Reverse an Array Without Copying
    9. 3.9 Multidimensional Arrays
    10. 3.10 Problem: Transpose of a Matrix
    11. 3.11 Summary
    12. Key Terms
    13. Review Questions
    14. Exercises
  13. Chapter 4: Methods in Java
    1. 4.1 Introduction
    2. 4.2 Defining a Method
    3. 4.3 Calling a Method
    4. 4.4 Problem: Nested Method Calls
    5. 4.5 Problem: Calculate Area of Geometric Objects
    6. 4.6 Problem: Generate Prime Numbers
    7. 4.7 Recursion: Power and Pitfalls
    8. 4.8 Method Overloading
    9. 4.9 Passing One-Dimensional Arrays to Methods
    10. 4.10 Problem: Method to Sort Names
    11. 4.11 Passing Two-Dimensional Arrays to Methods
    12. 4.12 Variable Length Argument Lists
    13. 4.13 Summary
    14. Key Terms
    15. Review Questions
    16. Exercises
  14. Part II Object Oriented Java Programming
  15. Chapter 5: Classes and Objects
    1. 5.1 Introduction
    2. 5.2 Object-Oriented Programming Paradigm
    3. 5.3 Creating a Class
    4. 5.4 Problem: Designing Object-Oriented College Aplication
    5. 5.5 Creating Data Members
    6. 5.6 Creating Member Functions
    7. 5.7 Static Data and Methods
    8. 5.8 Array of Objects
    9. 5.9 Objects as Arguments to Methods
    10. 5.10 Summary
    11. Key Terms
    12. Review Questions
    13. Exercises
  16. Chapter 6: Inheritance and Polymorphism
    1. 6.1 Introduction
    2. 6.2 Constructors
    3. 6.3 Default Constructor
    4. 6.4 Parameterized Constructor
    5. 6.5 Constructor Overloading
    6. 6.6 Essential Java.lang Classes
      1. 6.6.1 Math
      2. 6.6.2 Character
      3. 6.6.3 String
      4. 6.6.4 StringBuffer
      5. 6.6.5 StringBuilder
    7. 6.7 Inheritance
    8. 6.8 Calling Base Class Constructor
    9. 6.9 Calling Base Class Data Member with Super
    10. 6.10 Overriding and Polymorphism
    11. 6.11 Aggregation Versus Inheritance
    12. 6.12 Object and Object Cloning
    13. 6.13 Checking Object’s Class Type
    14. 6.14 Preventing Inheritance and Overriding
    15. 6.15 Visibility of Members of a Class
    16. 6.16 Inner Classes
    17. 6.17 Summary
    18. Key Terms
    19. Review Questions
    20. Exercises
  17. Chapter 7: More on Objects and Exceptions
    1. 7.1 Introduction
    2. 7.2 Abstract Classes
      1. 7.2.1 Defining Abstract Classes
      2. 7.2.2 Defining Abstract Methods
    3. 7.3 Interfaces
      1. 7.3.1 Declaring Interfaces
      2. 7.3.2 Implementing Interfaces
      3. 7.3.3 Problem: Flyable Interface
    4. 7.4 Java Enums
      1. 7.4.1 Basics of Enum
      2. 7.4.2 Advanced Features of Enum
    5. 7.5 Packages
      1. 7.5.1 Creating a Package
      2. 7.5.2 Importing Packages
      3. 7.5.3 Including Classes to Package
      4. 7.5.4 Subpackages
      5. 7.5.5 Protected Members Revisited
    6. 7.6 Exception Handling
      1. 7.6.1 Try-Catch-Finally Statements
      2. 7.6.2 Multicatch Statement
      3. 7.6.3 Exception Hierarchy
      4. 7.6.4 User-defined Exceptions with throw and throws
      5. 7.6.5 Extending RuntimeException Class
    7. 7.7 Summary
    8. Key Terms
    9. Review Questions
    10. Exercises
  18. Part III Java Containers for Holding Objects
  19. Chapter 8: Sequence Containers
    1. 8.1 Introduction
    2. 8.2 Collection Taxonomy
    3. 8.3 Vectors
      1. 8.3.1 Enumeration
      2. 8.3.2 Type-Specific Vectors
    4. 8.4 StringTokenizer
    5. 8.5 Stack
      1. 8.5.1 Character Stack
      2. 8.5.2 Problem: Brackets Matching
    6. 8.6 Iterators
    7. 8.7 PriorityQueue
    8. 8.8 ArrayList
      1. 8.8.1 Type-Safe ArrayLists
      2. 8.8.2 Problem: Shopping Cart
      3. 8.8.3 Problem: Search an Element Inside Array
      4. 8.8.4 Problem: Merge Two Arrays
      5. 8.8.5 Problem: Remove All Duplicates in an Array
    9. 8.9 LinkedList
      1. 8.9.1 Problem: Designing Stack Using LinkedList
      2. 8.9.2 Type-safe LLStack Using Generics
    10. 8.10 Summary
    11. Key Terms
    12. Review Questions
    13. Exercises
  20. Chapter 9: Map Containers
    1. 9.1 Introduction
    2. 9.2 Hashtable
    3. 9.3 Problem: Word Counting in a Text
    4. 9.4 Problem: Couples-Sensitive Brackets Checker
    5. 9.5 HashMap
    6. 9.6 Multimaps
    7. 9.7 Nested HashMaps
    8. 9.8 LinkedHashMap
    9. 9.9 TreeMap
    10. 9.10 Problem: Random Number Generator
    11. 9.11 Properties
    12. 9.12 Summary
    13. Key Terms
    14. Review Questions
    15. Exercises
  21. Chapter 10: Set Containers
    1. 10.1 Introduction
    2. 10.2 Set Interface
    3. 10.3 HashSet
    4. 10.4 Problem: Counting Duplicates in a Text
    5. 10.5 LinkedHashSet
    6. 10.6 TreeSet
    7. 10.7 Summary
    8. Key Terms
    9. Review Questions
    10. Exercises
  22. Chapter 11: Sorting and Searching
    1. 11.1 Introduction
    2. 11.2 Sorting and Searching Using Arrays Class
    3. 11.3 Filling and Copying Arrays
    4. 11.4 Comparing Arrays
    5. 11.5 Sorting Primitive Arrays
    6. 11.6 Sorting String Objects
    7. 11.7 Array Sorting Using Comparable
    8. 11.8 Array Sorting Using Comparator
    9. 11.9 Searching Sorted Arrays
    10. 11.10 Sorting and Searching Using Collections Class
    11. 11.11 Sorting Lists Using Comparable
    12. 11.12 Sorting Lists Using Comparator
    13. 11.13 Summary
    14. Key Terms
    15. Review Questions
    16. Exercises
  23. Part IV Java Threads and IO Streams
  24. Chapter 12: Concurrency Using Threads
    1. 12.1 Introduction
    2. 12.2 Multithreading Using Thread Class
    3. 12.3 Making Threads to Sleep
    4. 12.4 Yielding Control to Other Threads
    5. 12.5 Problem: Multithreaded Adder
    6. 12.6 Suspending Caller Thread
    7. 12.7 Daemon Threads
    8. 12.8 Thread Priority
    9. 12.9 Multithreading Using Runnable
    10. 12.10 Thread Synchronization for Resource Sharing
    11. 12.11 Synchronized Methods
    12. 12.12 Synchronized Block
    13. 12.13 Cordination Among Threads
    14. 12.14 Problem: Car Dealer Application
    15. 12.15 Threads Life
    16. 12.16 Concurrent Programming Packages
    17. 12.17 The Concurrent Package
    18. 12.18 The Concurrent.Atomic Package
    19. 12.19 Problem: Random Strings Generator
    20. 12.20 The Concurrent.locks Package
    21. 12.21 Summary
    22. Key Terms
    23. Review Questions
    24. Exercises
  25. Chapter 13: Processing Byte and Object Streams
    1. 13.1 Introduction
    2. 13.2 The File Class
    3. 13.3 Filtering File Names
    4. 13.4 Filtering Absolute File Paths
    5. 13.5 Types of Input Streams
      1. 13.5.1 Reading Files as Bytes
      2. 13.5.2 Reading Files into Byte Array
      3. 13.5.3 Reading Strings as Bytes
    6. 13.6 Types of Output Streams
      1. 13.6.1 Writing to Files as Bytes
      2. 13.6.2 Writing to Byte Array as Bytes
    7. 13.7 Problem: Copy Files as Bytes
    8. 13.8 Processing Primitive Data Types
    9. 13.9 Problem: Generating Students Mark List
    10. 13.10 Serializing Objects
    11. 13.11 Problem: Generating Students’ MarkList – Revisited
    12. 13.12 Transient Variables
    13. 13.13 Summary
    14. Key Terms
    15. Review Questions (1/2)
    16. Review Questions (2/2)
    17. Exercises
  26. Chapter 14: Processing Character Streams and NIO
    1. 14.1 Introduction
    2. 14.2 Types of Readers
      1. 14.2.1 Reading Files as Characters
      2. 14.2.2 Problem: Word Counting Using FileReader
      3. 14.2.3 Reading Files as Lines
      4. 14.2.4 Problem: Text Index Generator
    3. 14.3 Types of Writers
      1. 14.3.1 Writing Characters to File
      2. 14.3.2 Problem: Copy Files Using FileWriter
      3. 14.3.3 Writing Lines to Files
    4. 14.4 Writing to and Reading from Pipes
    5. 14.5 Formatted Printing
    6. 14.6 Random Access File
    7. 14.7 Converting Bytes to Characters
    8. 14.8 File Processing Using NIO
    9. 14.9 Reading Data from Buffer
    10. 14.10 Writing Data to Buffer
    11. 14.11 Copying Files
    12. 14.12 Locking Files
    13. 14.13 Summary
    14. Key Terms
    15. Review Questions
    16. Exercises
  27. Part V Java GUI Programming
  28. Chapter 15: Graphics Programming
    1. 15.1 Introduction
    2. 15.2 Swing Components and Containers: Overview
    3. 15.3 Frames and Panels
    4. 15.4 Drawing Shapes Using Graphics Context
    5. 15.5 Drawing Strings and Lines
    6. 15.6 Problem: Multiline Generation
    7. 15.7 Drawing Rectangles
    8. 15.8 Problem: Random Rectangle Generator
    9. 15.9 Drawing Circles and Ellipses
    10. 15.10 Drawing Arcs
    11. 15.11 Drawing Polygons and Polylines
    12. 15.12 Displaying Images
    13. 15.13 Problem: Threaded Blinking Balls
    14. 15.14 Painting Using JApplet
    15. 15.15 Java 2D Graphics
    16. 15.16 Drawing Lines and Curves
    17. 15.17 Drawing Rectangle, Ellipses and Arcs
    18. 15.18 Filling with Color, GradientPaint and TexturePaint
    19. 15.19 Drawing Arbitrary Shapes
    20. 15.20 Cordinate Transformations
    21. 15.21 2D Clipping
    22. 15.22 Affine Transformations on Images
    23. 15.23 Summary
    24. Key Terms
    25. Review Questions
    26. Exercises
  29. Chapter 16: GUI Development Using JFrame
    1. 16.1 Introduction
    2. 16.2 Creating Labels and Buttons
    3. 16.3 Problem: Digital Clock as JLabel
    4. 16.4 Basics of Event Handling
    5. 16.5 Layout Managers
      1. 16.5.1 FlowLayout
      2. 16.5.2 BorderLayout
      3. 16.5.3 GridLayout
      4. 16.5.4 Multiple Layouts Using JPanel
      5. 16.5.5 BoxLayout and Box
    6. 16.6 Event Handling Revisited
    7. 16.7 Problem: Color Label Aplication
    8. 16.8 Problem: Throw Ball Aplication
    9. 16.9 Creating Text Field and Text Area
    10. 16.10 Problem: File Lister
    11. 16.11 Problem: Numeric Text Field
    12. 16.12 Problem: Text Copy Cat
    13. 16.13 Creating CheckBox, RadioButton, ComboBox and List
      1. 16.13.1 CheckBoxes
      2. 16.13.2 Radio Buttons
      3. 16.13.3 Combo Boxes
      4. 16.13.4 Lists
    14. 16.14 Dialog Windows
    15. 16.15 Chosing File Names
    16. 16.16 Chosing Colors
    17. 16.17 Displaying Messages
      1. 16.17.1 Message Dialogs
      2. 16.17.2 Confirm Dialogs
      3. 16.17.3 Option Dialogs
      4. 16.17.4 Input Dialogs
    18. 16.18 Problem: Designing Course Registration Form (1/2)
    19. 16.18 Problem: Designing Course Registration Form (2/2)
    20. 16.19 Creating Editor Pane and Text Pane
    21. 16.20 Creating Slider
    22. 16.21 Designing Tabbed Pane
    23. 16.22 Handling Menu
    24. 16.23 Table Handling
    25. 16.24 Creating Custom Swing Components
    26. 16.25 Summary
    27. Key Terms
    28. Review Questions
    29. Exercises
  30. Chapter 17: GUI Development Using JApplet
    1. 17.1 Introduction
    2. 17.2 Applet Advantages and Restrictions
    3. 17.3 Creating and Running Applets
      1. 17.3.1 Running Applets with Web Browser
      2. 17.3.2 Running Applets with Appletviewer
      3. 17.3.3 Running Applets with Java Interpreter
    4. 17.4 Creating GUI Components inside Applets
    5. 17.5 Applet Input Parameters
    6. 17.6 Images in Applets
    7. 17.7 Timers Firing ActionEvent
    8. 17.8 Playing Audio Clips
    9. 17.9 Handling Mouse Event
    10. 17.10 Handling Hyperlink Event
    11. 17.11 Building Archives Using JAR
    12. 17.12 Signing Applets
    13. 17.13 Problem: Accessing Websites from WWW
    14. 17.14 Summary
    15. Key Terms
    16. Review Questions
    17. Exercises
  31. Appendix A
  32. Appendix B
  33. Appendix C
  34. Index (1/2)
  35. Index (2/2)

Product information

  • Title: Java Programming, 1st Edition by Pearson
  • Author(s): K. Rajkumar
  • Release date: May 2024
  • Publisher(s): Pearson India
  • ISBN: 9789332517868