You are previewing Java Quick Syntax Reference.
O'Reilly logo
Java Quick Syntax Reference

Book Description

The Java Quick Syntax Reference is a condensed code and syntax reference to the Java programming language. It presents the essential Java syntax in a well-organized format that can be used as a handy reference.

You won't find any technical jargon, bloated samples, drawn out history lessons or witty stories in this book. What you will find is a language reference that is concise, to the point and highly accessible. The book is packed with useful information and is a must-have for any Java programmer.

In the Java Quick Syntax Reference, you will find:

  • A concise reference to the Java language syntax

  • Short, simple and focused code examples

  • A well laid out table of contents and a comprehensive index allowing easy review

What you'll learn

  • How to do a Java HelloWorld

  • How to compile and run

  • What are Java variables and operators

  • What are arrays, strings, conditionals, loops and more

  • How to use methods, classes and more

  • How to work with constructors, inheritance and overriding

  • How to use packages, access levels, constants, and interfaces

  • How to code with enums and generics

  • How to handle exceptions

  • How to do boxing and unboxing

Who this book is for

This book is a handy, pocket quick syntax reference for experienced Java programmers as well as other programmers new to Java.

Table of Contents

  1. Title Page
  2. Contents at a Glance
  3. Contents
  4. About the Author
  5. Introduction
  6. CHAPTER 1: Hello World
    1. Installing
    2. Creating a project
    3. Hello world
    4. Code hints
  7. CHAPTER 2: Compile and Run
    1. Running from the IDE
    2. Running from a console window
    3. Comments
  8. CHAPTER 3: Variables
    1. Data types
    2. Declaring variables
    3. Assigning variables
    4. Using variables
    5. Integer types
    6. Floating-point types
    7. Char type
    8. Boolean type
    9. Variable scope
    10. Anonymous block
  9. CHAPTER 4: Operators
    1. Arithmetic operators
    2. Assignment operators
    3. Combined assignment operators
    4. Increment and decrement operators
    5. Comparison operators
    6. Logical operators
    7. Bitwise operators
    8. Operator precedence
  10. CHAPTER 5: String
    1. Combining strings
    2. Escape characters
    3. String compare
    4. StringBuffer class
  11. CHAPTER 6: Arrays
    1. Array declaration
    2. Array allocation
    3. Array assignment
    4. Multi-dimensional arrays
    5. ArrayList class
  12. CHAPTER 7: Conditionals
    1. If statement
    2. Switch statement
    3. Ternary operator
  13. CHAPTER 8: Loops
    1. While loop
    2. Do-while loop
    3. For loop
    4. Foreach loop
    5. Break and continue
    6. Labeled block
  14. CHAPTER 9: Methods
    1. Defining methods
    2. Calling methods
    3. Method parameters
    4. Return statement
    5. Method overloading
    6. Passing arguments
  15. CHAPTER 10: Class
    1. Object creation
    2. Accessing object members
    3. Constructor
    4. This keyword
    5. Constructor overloading
    6. Constructor chaining
    7. Initial field values
    8. Default constructor
    9. Null
    10. Default values
    11. Garbage collector
  16. CHAPTER 11: Static
    1. Accessing static members
    2. Static methods
    3. Static fields
    4. Static initialization blocks
    5. Instance Initialization blocks
  17. CHAPTER 12: Inheritance
    1. Object
    2. Upcasting
    3. Downcasting
    4. Instanceof operator
  18. CHAPTER 13: Overriding
    1. Overriding members
    2. Override annotation
    3. Hiding members
    4. Preventing method inheritance
    5. Accessing overridden methods
    6. Calling parent constructor
  19. CHAPTER 14: Packages and Import
    1. Import specific class
    2. Import package
    3. Import static
  20. CHAPTER 15: Access Levels
    1. Private access
    2. Package-private access
    3. Protected access
    4. Public access
    5. Top-level access
    6. Nested class access
    7. Access level guideline
  21. CHAPTER 16: Constants
    1. Local constants
    2. Constant fields
    3. Constant method parameters
    4. Compile-time and run-time constants
    5. Constant guideline
  22. CHAPTER 17: Interface
    1. Interface members
    2. Interface example
    3. Functionality interface
    4. Class interface
    5. Interface classes
  23. CHAPTER 18: Abstract
    1. Abstract class example
    2. Abstract classes and interfaces
    3. Abstract class and interface guideline
  24. CHAPTER 19: Enum
    1. Enum example
    2. Enum class
  25. CHAPTER 20: Exception Handling
    1. Try-catch
    2. Catch block
    3. Finally block
    4. Throwing exceptions
    5. Checked and unchecked exceptions
    6. Exception hierarchy
  26. CHAPTER 21: Boxing and Unboxing
    1. Autoboxing and autounboxing
    2. Primitive and wrapper guideline
  27. CHAPTER 22: Generics
    1. Generic classes
    2. Generic methods
    3. Calling generic methods
    4. Generic interfaces
    5. Generic type parameters
    6. Generic variable usages
    7. Bounded type parameters
    8. Generics and Object
  28. Index