Java : a beginner's guide /
Schildt, Herbert.
Includes bibliographical references (page xxiv) and index.
"Fully updated for Java SE 8 (JDK 8). Create, compile, and run Java programs today"--Cover.
"Oracle. Oracle Press"--Cover.
1. Java fundamentals. The origins of Java : How Java relates to C and C++ ; How Java relates to C# -- Java's contribution to the internet : Java applets ; Security ; Portability -- Java's magic: the bytecode -- The Java buzzwords -- Object-oriented programming : Encapsulation ; Polymorphism ; Inheritance -- Obtaining the Java development kit -- A first simple program : Entering the program ; Compiling the program ; The first sample program line by line -- Handling syntax errors -- A second simple program -- Another data type -- Try this 1-1: Converting gallons to liters -- Two control statements : The if statement ; The for loop -- Create blocks of code -- Semicolons and positioning -- Indentation practices -- Try this 1-2: Improving the gallons-to-liters converter -- The Java keywords -- Identifiers in Java -- The Java class libraries -- Chapter 1 self test -- 2. Introducing data types and operators. Why data types are important -- Java's primitive types : Integers ; Floating-point types ; Characters -- The Boolean type -- Try this 2-1: How far away is the lightning? -- Literals : Hexadecimal, octal, and binary literals ; Character escape sequences ; String literals -- A closer look at variables : Initializing a variable ; Dynamic initialization -- The scope and lifetime of variables -- Operators -- Arithmetic operators : Increment and decrement -- Relational and logical operators -- Short-circuit logical operators -- The assignment operator -- Shorthand assignments -- Type conversion in assignments -- Casting incompatible types -- Operator precedence -- Try this 2-2: Display a truth table for the logical operators -- Expressions : Type conversion in expressions ; Spacing and parentheses -- Chapter 2 self test -- 3. Program control statements. Input characters from the keyboard -- The if statement -- Nested ifs -- The if-else-if ladder -- The switch statement -- Nested switch statements -- Try this 3-1: Start building a Java help system -- The for loop -- Some variations on the for loop -- Missing pieces : The infinite loop -- Loops with no body -- Declaring loop control variables inside the for loop -- The enhanced for loop -- The while loop -- The do-while loop -- Try this 3-2: Improve the Java help system-- Use break to exit a loop -- Use break as a form of goto -- Use continue -- Try this 3-3: Finish the Java help system -- Nested loops-- Chapter 3 self test -- 4. Introducing classes, objects, and methods. Class fundamentals : The general form of a class ; Defining a class -- How objects are created -- Reference variables and assignment -- Methods : Adding a method to the vehicle class -- Returning from a method -- Returning a value -- Using parameters : Adding a parameterized method to vechicle -- Try this 4-1: Creating a help class -- Constructors -- Parameterized constructors -- Adding a constructor to the vehicle class -- The new operator revisited -- Garbage collection -- The finalize( ) method -- Try this 4-2: Demonstrate garbage collection and finalization -- The this keyword -- Chapter 4 self test -- 5. More data types and operators. Arrays : One-dimensional arrays -- Try this 5-1: Sorting an array -- Multidimensional arrays : Two-dimensional arrays -- Irregular arrays : Arrays of three or more dimensions ; Initializing multidimensional arrays -- Alternative array declaration syntax -- Assigning array references -- Using the length member -- Try this 5-2: A queue class -- The for-each style for loop : Iterating over multidimensional arrays ; Applying the enhanced for -- Strings : Constructing strings ; Operating on strings ; Arrays of strings ; Strings are immutable ; Using a string to control a switch statement -- Using command-line arguments -- The bitwise operators : The bitwise AND, OR, XOR, and NOT operators ; The shift operators ; Bitwise shorthand assignments -- Try this 5-3: A ShowBits class -- The ? operator -- Chapter 5 self test -- 6. A closer look at methods and classes. Controlling access to class members : Java's access modifiers -- Try this 6-1: Improving the queue class -- Pass objects to methods : How arguments are passed -- Returning objects -- Method overloading -- Overloading constructors -- Try this 6-2: Overloading the queue constructor -- Recursion -- Understanding static : Static blocks -- Try this 6-3: The Quicksort -- Introducing nested and inner classes -- Varargs: variable-length arguments : Varargs basics ; Overloading varargs methods ; Varargs and ambiguity -- Chapter 6 self test -- 7. Inheritance. Inheritance basics -- Member access and inheritance -- Constructors and inheritance -- Using super to call superclass constructors -- Using super to access superclass members -- Try this 7-1: Extending the vehicle class -- Creating a multilevel hierarchy-- When are constructors executed? -- Superclass references and subclass objects -- Method overriding -- Overridden methods support polymorphism -- Why overridden methods? : Applying method overriding to twoDshape -- Using abstract classes -- Using final : Final prevents overriding ; Final prevents inheritance ; Using final with data members -- The object class -- Chapter 7 self test -- 8. Packages and interfaces. Packages : Defining a package ; Finding packages and CLASSPATH ; A short package example -- Packages and member access : A package access example -- Understanding protected members -- Importing packages -- Java's class library is contained in packages -- Interfaces -- Implementing interfaces -- Using interface references -- Try this 8-1: Creating a queue interface -- Variables in interfaces -- Interfaces can be extended -- Default interface methods : Default method fundamentals ; A more practical example of a default method ; Multiple inheritance issues -- Use static methods in an interface -- Final thoughts on packages and interfaces -- Chapter 8 self test -- 9. Exception handling. The exception hierarchy -- Exception handling fundamentals : Using try and catch ; A simple exception example -- The consequences of an uncaught exception : Exceptions enable you to handle errors gracefully -- Using multiple catch statements -- Catching subclass exceptions -- Try blocks can be nested -- Throwing an exception : Rethrowing an exception -- A closer look at throwable -- Using finally -- Using throws -- Three recently added exception features -- Java's built-in exceptions -- Creating exception subclasses -- Try this 9-1: Adding exceptions to the queue class -- Chapter 9 self test --
10. Using I/O. Java's I/O is built upon streams -- Byte streams and character streams -- The byte stream classes -- The character stream classes -- The predefined streams -- Using the byte streams : Reading console input ; Writing console output -- Reading and writing files using byte streams : Inputting from a file ; Writing to a file -- Automatically closing a file -- Reading and writing binary data -- Try this 10-1: A file comparison utility -- Random-access files -- Using Java's character-based streams : Console input using character streams ; Console output using character streams -- File I/O using character streams : Using a FileWriter ; Using a FileReader -- Using Java's type wrappers to convert numeric strings -- Try this 10-2: Creating a disk-based help system -- Chapter 10 self test -- 11. Multithreaded programming. Multithreading fundamentals -- The thread class and runnable interface -- Creating a thread : Some simple improvements -- Try this 11-1: Extending thread -- Creating multiple threads -- Determining when a thread ends -- Thread priorities -- Synchronization -- Using synchronized methods -- The synchronized statement -- Thread communication using notify( ), wait( ), and notify all( ) : An example that uses wait( ) and notify ( ) -- Suspending, resuming, and stopping threads -- Try this 11-2: Using the main thread -- Chapter 11 self test -- 12. Enumerations, autoboxing, static import, and annotations. Enumerations : Enumeration fundamentals -- Java enumerations are class types -- The values( ) and valueOf( ) methods -- Constructors, methods, instance variables, and enumerations : Two important restrictions -- Enumerations inherit enum -- Try this 12-1: A computer-controlled traffic light -- Autoboxing -- Type wrappers -- Autoboxing fundamentals -- Autoboxing and methods -- Autoboxing/unboxing occurs in expressions : A word of warning -- Static import -- Annotations (metadata) -- Chapter 12 self test -- 13. Generics. Generics fundamentals -- A simple generics example : Generics work only with reference types ; Generic types differ based on their type arguments ; A generic class with two type parameters ; The general form of a generic class -- Bounded types -- Using wildcard arguments -- Bounded wildcards -- Generic methods -- Generic constructors -- Generic interfaces -- Try this 13-1: Create a generic queue -- Raw types and legacy code -- Type inference with the diamond operator -- Erasure -- Ambiguity errors -- Some generic restrictions : Type parameters can't be instantiated ; Restrictions on static members ; Generic array restrictions ; Generic exception restriction -- Continuing your study of generics - Chapter 13 self test -- 14. Lambda expressions and method references. Introducing lambda expressions : Lambda expression fundamentals ; Functional interfaces ; Lambda expressions in action -- Block lambda expressions -- Generic functional interfaces -- Try this 14-1: Pass a lambda expression as an argument -- Lambda expressions and variable capture -- Throw an exception from within a lambda expression -- Method references : Method references to static methods ; Method referenes to instance methods -- Constructor references -- Predefined functional interfaces - Chapter 14 self test -- 15. Applets, events, and miscellaneous topics. Applet basics -- Applet organization and essential elements -- The applet architecture -- A complete applet skeleton -- Applet initialization and termination -- Requesting repainting : The update( ) method -- Try this 15-1: A simple banner applet -- Using the status window -- Passing parameters to applets -- The applet class -- Event handling -- The delegation event model -- Events : Event sources ; Event listeners ; Event classes ; Event listener interfaces -- Using the delegation event model : Handling mouse and mouse motion events ; A simple mouse event applet -- More Java keywords : The transient and volatile modifiers ; Instanceof ; Strictfp ; Assert ; Native methods -- Chapter 15 self test -- 16. Introducing swing. The origins and design philosophy of swing -- Components and containers : Components ; Containers ; The top-level container panes -- Layout managers -- A first simple swing program : The first swing example line by line -- Use JButton -- Work with JTextField -- Create a JCheckBox -- Work with JList -- Try this 16-1: A swing-based file comparison utility -- Use anonymous inner classes or lambda expressions to handle events -- Create a swing applet -- Chapter 16 self test -- 17. Introducing JavaFX. JavaFX basic concepts : The JavaFX packages ; The stage and scene classes ; Nodes and scene graphs ; Layouts ; The application class and the life-cycle methods ; Launching a JavaFX application -- A JavaFX application skeleton -- Compiling and running a JavaFX program -- The application thread -- A simple JavaFX control: label -- Using buttons and events : Event basics ; Introducing the button control ; Demonstrating event handling and the button -- Three more JavaFX controls : CheckBox -- Try this 17-1: Use the CheckBox indeterminate state : ListView ; TextField -- Introducing effects and transforms : Effects ; Transforms ; Demonstrating effects and transforms -- What next? -- Chapter 17 self test -- Answers to self tests -- Using Java's documentation comments. The javadoc tags : @author ; {@code} ; @deprecated ; {@docRoot} ; @exception ; {@inheritDoc} ; {@link} ; {@linkplain} ; {@literal} ; @param ; @return ; @see ; @serial ; @serialData ; @serialField ; @since ; @throws ; {@value} ; @version -- The general form of a documentation comment -- What javadoc outputs -- An example that uses documentation comments.
Java (Computer program language)