The Book
Constructive Java Programming is designed for those readers who wish to start learning to program in an object-oriented programming language. It brings the basic concepts as well as some advanced concepts of Java together, so that all engineering/science students and experienced programmers can easily find relevant information in one book. Each chapter concludes with Short Questions, Comprehensive Questions, Solved Programs and Programming Exercises. These will aid in self-evaluation and enhance the students’ understanding of the subject.
Salient features
- Essentials of Java language such as classes, objects, packages and interfaces.
- Focus on applications and GUI development with AWT, applets and Swing.
- Delineation of Multi-threading, Files and I/O streams.
- Accessing databases with JDBC.
- Exclusive chapters on Collections and Design Patterns.
- Internet applications with servlets and JSP.
- Web applications with MVC design patterns and MVC DB access.
The Author(s)
Sagayaraj is Associate Professor, Department of Computer Science, Head, PG Department of Computer Science and IQAC coordinator, Sacred Heart College (Autonomous), Tirupattur, Tamil Nadu.
Denis, Karthik and Gajalakshmi are Assistant Professors, Department of Computer Science, Sacred Heart College (Autonomous), Tirupattur, Tamil Nadu.
Table of Contents
Preface
Acknowledgments
About the Authors
Chapter 1: Foundations of Java
1.1 Stage for Java
1.2 Origin of Java
1.3 Challenges of Java
1.4 Java Features
1.5 Object-oriented Programming
Chapter 2: Java Essentials
2.1 Elements of a Java Program
2.2 Java API
2.3 Variables
2.4 Primitive Data Types
2.5 The String Class
2.6 Operators
2.7 Combined Assignment Operators
2.8 Conversion Between Primitive Data Types
2.9 Scope of Variables and Blocks
2.10 Comments
2.11 Understanding Keyboard Input
Chapter 3: Control Statements
3.1 The if Statement
3.2 The if-else Statement
3.3 Nested if Statements
3.4 The if-else-if Statement
3.5 Logical Operators
3.6 Comparing String Objects
3.7 The Conditional Operator
3.8 The switch Statement
3.9 Increment and Decrement Operators
3.10 while Loop
3.11 do-while Loop
3.12 for Loop
3.13 Nested Loops
3.14 break and continue Statements
3.15 Deciding Which Loop to Use
Chapter 4: Classes and Objects
4.1 Classes and Objects
4.2 Modifiers
4.3 Passing Arguments
4.4 Constructors
4.5 Packages and Import Statements
4.6 Static Class Members
4.7 Method Overloading
4.8 Constructor Overloading
4.9 Methods Returning Objects
4.10 this Reference Variable
4.11 Recursion
4.12 Nested and Inner Classes
4.13 Abstract Classes and Methods
4.14 Wrapper Classes
4.15 Generics
4.16 Autoboxing and Unboxing
4.17 Metadata (Annotations)
Chapter 5: Arrays
5.1 Introduction to Arrays
5.2 Processing Array Contents
5.3 Passing Arrays as Arguments to Methods
5.4 Returning Arrays from Methods
5.5 String Arrays
5.6 Arrays of Objects
5.7 Two Dimensional Arrays
5.8 Arrays with Three or More Dimensions
Chapter 6: String Handling
6.1 String Class
6.2 String Concatenation
6.3 Comparing Strings
6.4 Substring
6.5 String Class Methods
6.6 Other String Class Methods
6.7 StringBuffer Class
6.8 StringBuilder Class
6.9 StringTokenizer Class
Chapter 7: Inheritance
7.1 Basics of Inheritance
7.2 Inheriting and Overriding Superclass Methods
7.3 Calling Superclass Constructor
7.4 Polymorphism
7.5 Classes that Inherit from Different Classes
7.6 Abstract Classes
7.7 Final Class
Chapter 8: Interface and Package
8.1 Basics of Interface
8.2 Multiple Interfaces
8.3 Multiple Inheritance Using Interface
8.4 Multilevel Interface
8.5 Packages
8.6 Create and Access Packages in Netbeans IDE
8.7 Static Import and Package Class
8.8 Access Specifiers
Chapter 9: Exception Handling
9.1 Introduction
9.2 try and catch Block
9.3 Multiple catch Blocks
9.4 Nested try
9.5 finally Block
9.6 The throw Statement
9.7 Exception Propagation
9.8 throws Clause
9.9 Custom Exception
9.10 Built-in Exceptions
Chapter 10: Multithreading
10.1 Introduction
10.2 Threads in Java
10.3 Thread Creation
10.4 Life Cycle of a Thread
10.5 Joining a Thread
10.6 Thread Scheduler and Priority
10.7 Thread Synchronisation
10.8 Inter-thread Communication
10.9 Thread Control
10.10 Thread Pool
10.11 Thread Group
10.12 Daemon Thread
Chapter 11: Files and I/O Streams
11.1 The file Class
11.2 Streams
11.3 The Byte Streams
11.4 Filtered Byte Streams
11.5 The RandomAccessFile Class
11.6 The Character Streams
Chapter 12: Applets
12.1 Applet Fundamentals
12.2 Applet Class
12.3 Applet Life Cycle
12.4 Steps for Developing an Applet Program
12.5 Passing Values Through Parameters
12.6 Graphics in an Applet
12.7 Event Handling
Chapter 13: GUI Applications – Part 1
13.1 Graphical User Interface
13.2 Creating Windows
13.3 Dialog Boxes
13.4 Layout Managers
13.5 AWT Component Classes
13.6 Swing Component Classes
13.7 Simple Applications Using AWT Controls
Chapter 14: GUI Applications – Part 2
14.1 Event Handling
14.2 Other AWT Components
14.3 AWT Graphics Classes
14.4 Other Swing Controls
14.5 Simple Applications Using Swing and AWT
Chapter 15: Java Database Connectivity
15.1 Types of Drivers
15.2 JDBC Architecture
15.3 JDBC Classes and Interfaces
15.4 Basic Steps in Developing JDBC Applications
15.5 Creating a New Database and Table with JDBC
15.6 Working with Database Metadata
Chapter 16: Collections
16.1 Overview of Collection Framework
16.2 Collection Interface
16.3 Collections Implementation Classes
16.4 Hashtable and Hashmap vs Hashtable Sorting
16.5 Sorting in Collection
16.6 Comparable vs Comparator Interfaces
Chapter 17: Design Patterns
17.1 Introduction
17.2 Catalogue for Design Pattern
17.3 Factory Method Pattern Definition
17.4 Prototype Pattern
17.5 Singleton Pattern
17.6 Proxy Pattern
17.7 Iterator Pattern
Chapter 18: Servlets
18.1 Basics of Servlet
18.2 Servlet Alternative
18.3 Servlet Strengths
18.4 Servlet Architecture
18.5 Servlet Life Cycle
18.6 Generic Servlet
18.7 Httpservlet
18.8 First Servlet
18.9 Passing Parameters to Servlets
18.10 Retrieving Parameters
18.11 Cookies
18.12 Problems with Servlets
Chapter 19: Java Server Pages
19.1 Overview 527
19.2 JSP HTTP and Engines
19.3 Working of JSP
19.4 Anatomy of a JSP Page
19.5 JSP Syntax
19.6 Creating a Simple JSP Page
19.7 Components of JSP
19.8 Implicit Objects
Chapter 20: Introduction to MVC
20.1 Structure of MVC Framework
20.2 Developing Web Applications with MVC Design Pattern
20.3 MVC with DB Access
Index