The class of Java

Book description

This book focuses on JAVA, which is an object-oriented and platform-independent language. JAVA has surely become the language of choice for web developers with the popularizing of Internet.

Table of contents

  1. Cover
  2. Title Page
  3. Contents
  4. Preface
  5. Foreword
  6. About the Author
  7. 1. Object-oriented Programming and Introduction to Java
    1. 1.1 Why is Java so Popular?
      1. 1.1.1 Platform Independent
      2. 1.1.2 Applets and Servlets for the Web
      3. 1.1.3 Object-oriented Programming
      4. 1.1.4 Easy
    2. 1.2 Java Community
    3. 1.3 Rich API
    4. Lessons Learned
    5. Exercises
  8. 2. Creating an Application in Java
    1. 2.1 Installing JDK
    2. 2.2 The HelloWorld Sample Application
    3. 2.3 Compiling Java Files
    4. 2.4 Executing a Java Application
      1. 2.4.1 Using Command Line Arguments
    5. 2.5 Various Tools, Part of JDK
      1. 2.5.1 javadoc Utility and Documentation Comments
    6. Lessons Learned
    7. Exercises
  9. 3. Data Types
    1. 3.1 Primitive Data Types
      1. 3.1.1 boolean Data Type
      2. 3.1.2 Numeric Data Types
      3. 3.1.3 Specifying Constants
    2. 3.2 Unicode Escapes in Java Source Code
    3. 3.3 Reference Data Types
      1. 3.3.1 Arrays
      2. 3.3.2 Array of Reference Type
      3. 3.3.3 Two-dimensional and Multi-dimensional Arrays
      4. 3.3.4 Classes
      5. 3.3.5 Interfaces
      6. 3.3.6 Enum
      7. 3.3.7 Annotation
    4. 3.4 Super-types and sub-types
    5. Lessons Learned
    6. Exercises
  10. 4. Operators and Statements
    1. 4.1 Operators
      1. 4.1.1 Arithmetic Operators
      2. 4.1.2 String Concatenation
      3. 4.1.3 Relational Operators
      4. 4.1.4 Logical Operators
      5. 4.1.5 Bitwise Operators
      6. 4.1.6 Increment–Decrement Operators
      7. 4.1.7 Conditional Operator
      8. 4.1.8 Assignment Cast and instanceof Operators
      9. 4.1.9 Other Operators
    2. 4.2 Statements
      1. 4.2.1 Condition Statements—if, if-else and switch-case
      2. 4.2.2 Loop Statements—for, while and do-while
      3. 4.2.3 break, continue and return
    3. Lessons Learned
    4. Exercises
  11. 5. Defining a Class in Java
    1. 5.1 Various Members Within a Class
      1. 5.1.1 Instance Variables
      2. 5.1.2 Methods
      3. 5.1.3 Constructors
      4. 5.1.4 The finalize Method
      5. 5.1.5 static Variables and static Methods
      6. 5.1.6 Initializer Block
      7. 5.1.7 Class Initializer Block
    2. 5.2 Looking at the Entire Class
    3. Lessons Learned
    4. Exercises
  12. 6. Inheritance and Sub-classing
    1. 6.1 Defining Sub-classes
    2. 6.2 Using super to Use the Constructor of a Super-class
    3. 6.3 Method Overriding and the Use of super
    4. 6.4 Variable Shadowing and the Use of super
    5. 6.5 Method and Variable Binding
    6. 6.6 Using final with Variables, Methods and Classes
    7. Lessons Learned
    8. Exercises
  13. 7. Abstract Classes and Interfaces
    1. 7.1 Abstract Classes and Abstract Methods
    2. 7.2 Single Inheritance of Classes
    3. 7.3 Interfaces
    4. Lessons Learned
    5. Exercises
  14. 8. The Object Class
    1. 8.1 The Object Class as the Super-class of all Classes
      1. 8.1.1 Methods Inherited from the Object Class
    2. 8.2 Some Methods of the Class Class
    3. Lessons Learned
    4. Exercises
  15. 9. Creating Packages and Using Access Specifiers
    1. 9.1 Uses of Package and Import Statements
    2. 9.2 Use of Static Imports
    3. 9.3 Use of Classpath for Class Loading
    4. 9.4 Access specifiers
      1. 9.4.1 Access Specifiers for Members of a Package
      2. 9.4.2 Access Specifiers for Members of a Class
      3. 9.4.3 Access Specifiers for Overriding Methods
    5. 9.5 Revisiting javadoc
      1. 9.5.1 Generating javadoc According to the Target User
      2. 9.5.2 Using the Java APIs
      3. 9.5.3 Commonly Used Packages from the Java APIs
    6. Lessons Learned
    7. Exercises
  16. 10. Commonly Used Classes from the java.lang Package
    1. 10.1 Comparable and Comparator Interfaces
      1. 10.1.1 Comparable
      2. 10.1.2 Comparator
    2. 10.2 String Class
      1. 10.2.1 String Constants
      2. 10.2.2 Interfaces Implemented by String
      3. 10.2.3 Commonly Used Constructors of String Class
      4. 10.2.4 Common Methods from String Class
      5. 10.2.5 Methods Involving Regular Expresssions
      6. 10.2.6 Conversion of Primitives to String
    3. 10.3 StringBuffer and StringBuilder Classes
    4. 10.4 Supplementary Characters
    5. 10.5 Pass by Value and Pass by Reference
    6. 10.6 Wrapper Classes
      1. 10.6.1 Number Classes and their Methods
      2. 10.6.2 Boxing and Unboxing Conversions
    7. 10.7 Math Class
      1. 10.7.1 Numeric Values Requiring more than 64 Bits
    8. Lessons Learned
    9. Exercises
  17. 11. Exceptions
    1. 11.1 Runtime Stack and Execution of Application
    2. 11.2 The return and the throw Statements
    3. 11.3 The Return Type and throws Declaration in Methods
      1. 11.3.1 Checked and the Unchecked Exception Classes
    4. 11.4 The Throwable Class
      1. 11.4.1 Exception Chaining
    5. 11.5 Handling Exceptions with try and catch
    6. 11.6 Use of the finally Block
    7. 11.7 Creating Custom Exception Classes
    8. 11.8 Assertions
      1. 11.8.1 Agile Methodology and Assertions
    9. Lessons Learned
    10. Exercises
  18. 12. Nested and enum Types
    1. 12.1 Member Types
      1. 12.1.1 Top-level Nested Classes
      2. 12.1.2 Inner Classes
    2. 12.2 The Local Class
    3. 12.3 The Anonymous Class
    4. 12.4 The enum Type
    5. Lessons Learned
    6. Exercises
  19. 13. java.util Package and the Collection Framework
    1. 13.1 Date, TimeZone, Calendar and the GregorianCalendar Classes
    2. 13.2 Arrays Class
    3. 13.3 Collection Framework
      1. 13.3.1 Collection Interface
      2. 13.3.2 Set and List Interfaces
      3. 13.3.3 Map Interface
      4. 13.3.4 Generics in the Collection Framework
    4. 13.4 Collections Class
    5. 13.5 StringTokenizer Class
    6. 13.6 Regular Expressions, Pattern and Matcher Classes
      1. 13.6.1 Pattern and Matcher Classes
    7. 13.7 Scanner Class
    8. 13.8 Varargs and the Formatter Class
      1. 13.8.1 Formatter Class
    9. Lessons Learned
    10. Exercises
  20. 14. Input/Output Related Classes
    1. 14.1 File Management
    2. 14.2 Stream Classes
      1. 14.2.1 OutputStream and the Writer Classes
      2. 14.2.2 InputStream and the Reader Classes
      3. 14.2.3 Bridge Classes OutputStreamWriter and the InputStreamReader
      4. 14.2.4 Writing and Reading from Files Using FileOutputStream and the FileInputStream
      5. 14.2.5 Piped Streams
      6. 14.2.6 Array-based Streams
      7. 14.2.7 Filter Streams
      8. 14.2.8 Buffered Streams
      9. 14.2.9 Pushback Streams
      10. 14.2.10 PrintStream and the PrintWriter Classes
      11. 14.2.11 SequenceInputStream
      12. 14.2.12 Data and Object Streams
    3. 14.3 RandomAccessFile
    4. Lessons Learned
    5. Exercises
  21. 15. Networking
    1. 15.1 Networking Concepts
      1. 15.1.1 Various Layers/Protocol in Communication
    2. 15.2 Java API for Networking
      1. 15.2.1 InetAddress Class
      2. 15.2.2 Using Socket and ServerSocket for Client–Server Communication
      3. 15.2.3 URL
      4. 15.2.4 URLConnection
      5. 15.2.5 DatagramSocket and DatagramPacket for UDP-based Communication
    3. Lessons Learned
    4. Exercises
  22. 16. Multi-threading
    1. 16.1 Thread Class and Thread of Execution
    2. 16.2 Creating a New Thread of Execution
    3. 16.3 ThreadGroup
    4. 16.4 Properties of Thread Instance
      1. 16.4.1 Daemon Threads
      2. 16.4.2 Thread States
    5. 16.5 Synchronization
    6. 16.6 Another Way of Creating a Thread of Execution
    7. Lessons Learned
    8. Exercises
  23. 17. GUI—Getting Started
    1. 17.1 AWT and Swing
    2. 17.2 AWT Components
      1. 17.2.1 Overview of the AWT Components
      2. 17.2.2 Component Properties
      3. 17.2.3 Graphics Context
      4. 17.2.4 Toolkit Class
    3. Lessons Learned
    4. Exercises
  24. 18. GUI—Containers
    1. 18.1 Container Class
      1. 18.1.1 Layout Managers
    2. 18.2 Top-level Containers
      1. 18.2.1 Window Class
      2. 18.2.2 Decorated Windows Frame and Dialog
    3. 18.3 Other Containers
      1. 18.3.1 Panel Class
      2. 18.3.2 ScrollPane Class
    4. 18.4 Creating a GUI
    5. Lessons Learned
    6. Exercises
  25. 19. GUI—Events
    1. 19.1 Event Delegation Model
    2. 19.2 AWTEvents
      1. 19.2.1 ActionEvent
      2. 19.2.2 AdjustmentEvent
      3. 19.2.3 ItemEvent
      4. 19.2.4 TextEvent
      5. 19.2.5 ComponentEvent
      6. 19.2.6 ContainerEvent
      7. 19.2.7 FocusEvent
      8. 19.2.8 InputEvent
      9. 19.2.9 PaintEvent
      10. 19.2.10 WindowEvent
      11. 19.2.11 KeyEvent
      12. 19.2.12 MouseEvent
      13. 19.2.13 Adapter Classes
    3. Lessons Learned
    4. Exercises
  26. 20. GUI—Swing and MVC
    1. 20.1 Top-level Containers
      1. 20.1.1 JLayeredPane Class
    2. 20.2 JComponent
    3. 20.3 JOptionPane
      1. 20.3.1 Showing Message Dialogs
      2. 20.3.2 Showing Confirm Dialogs
      3. 20.3.3 Showing Input Dialogs
    4. 20.4 Model-View-Controller
      1. 20.4.1 JTable
      2. 20.4.2 JTree
    5. Lessons Learned
    6. Exercises
  27. 21. Building Applets
    1. 21.1 Browser as a Container for the Applet
    2. 21.2 Life-cycle of an Applet
    3. 21.3 AppletStub
    4. 21.4 Applet Tag
    5. 21.5 AppletContext
    6. 21.6 Applet Class
      1. 21.6.1 AudioClip
    7. 21.7 Security Issue
    8. Lessons Learned
    9. Exercises
  28. 22. Using JDBC APIs, for Interaction with Databases
    1. 22.1 ODBC and JDBC
    2. 22.2 JDBC Drivers
      1. 22.2.1 Types of JDBC Drivers
    3. 22.3 Using JDBC Drivers and the API
      1. 22.3.1 Overview of API Related to Connection and Interaction with Database
      2. 22.3.2 Connecting to a Database
      3. 22.3.3 Interacting with the Database
      4. 22.3.4 Examining the Results of a Query from the ResultSet
    4. 22.4 Managing Transactions
    5. 22.5 SQLException
    6. Lessons Learned
    7. Exercises
  29. 23. Annotations
    1. 23.1 Defining a New Annotation
    2. 23.2 Annotating a Programming Element
    3. 23.3 Annotation Element Names and Usage
    4. 23.4 Meta-annotations
      1. 23.4.1 Restricting Applicability of an Annotation
      2. 23.4.2 Retention Policy
    5. Lessons Learned
    6. Exercises
  30. Appendix A What is UTF?
  31. Appendix B Indic Characters in Unicode
  32. Appendix C Javadoc Tags
  33. Acknowledgements
  34. Copyright

Product information

  • Title: The class of Java
  • Author(s): Pravin Jain
  • Release date: August 2010
  • Publisher(s): Pearson India
  • ISBN: 9788131755440