The Definitive Java Programming Guide In Java: The Complete Reference, Eighth Edition , bestselling programming author Herb Schildt shows you everything you need to develop, compile, debug, and run Java programs. Updated for Java Platform, Standard Edition 7 (Java SE 7), this comprehensive volume covers the entire Java language, including its syntax, keywords, and fundamental programming principles. You'll also find information on key elements of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. In addition, new Java SE 7 features such as try-with-resources, strings in switch, type inference with the diamond operator, NIO.2, and the Fork/Join Framework are discussed in detail. Coverage includes: Data types and operators Control statements Classes and objects Constructors and methods Method overloading and overriding Interfaces and packages Inheritance Exception handling Generics Autoboxing Enumerations Annotations The try-with-resources statement Varargs Multithreading The I/O classes Networking The Collections Framework Applets and servlets JavaBeans AWT and Swing The Concurrent API Much, much more Contents......Page 12 Preface......Page 34 Part I: The Java Language......Page 38 Java’s Lineage......Page 40 The Creation of Java......Page 43 How Java Changed the Internet......Page 45 Java’s Magic: The Bytecode......Page 46 The Java Buzzwords......Page 47 The Evolution of Java......Page 50 A Culture of Innovation......Page 53 Object-Oriented Programming......Page 54 A First Simple Program......Page 60 A Second Short Program......Page 63 Two Control Statements......Page 65 Using Blocks of Code......Page 67 Lexical Issues......Page 69 The Java Class Libraries......Page 71 The Primitive Types......Page 72 Integers......Page 73 Floating-Point Types......Page 75 Characters......Page 76 Booleans......Page 77 A Closer Look at Literals......Page 78 Variables......Page 81 Type Conversion and Casting......Page 85 Automatic Type Promotion in Expressions......Page 86 Arrays......Page 88 A Few Words About Strings......Page 95 A Note to C/C++ Programmers About Pointers......Page 96 Arithmetic Operators......Page 98 The Bitwise Operators......Page 103 Relational Operators......Page 111 Boolean Logical Operators......Page 112 The ? Operator......Page 114 Operator Precedence......Page 115 Using Parentheses......Page 116 Java’s Selection Statements......Page 118 Iteration Statements......Page 126 Jump Statements......Page 139 Class Fundamentals......Page 146 Declaring Objects......Page 150 Introducing Methods......Page 152 Constructors......Page 158 The this Keyword......Page 161 The finalize( ) Method......Page 162 A Stack Class......Page 163 Overloading Methods......Page 166 Using Objects as Parameters......Page 171 A Closer Look at Argument Passing......Page 173 Returning Objects......Page 175 Recursion......Page 176 Introducing Access Control......Page 178 Understanding static......Page 182 Introducing final......Page 183 Arrays Revisited......Page 184 Introducing Nested and Inner Classes......Page 186 Exploring the String Class......Page 189 Using Command-Line Arguments......Page 191 Varargs: Variable-Length Arguments......Page 192 Inheritance Basics......Page 198 Using super......Page 204 Creating a Multilevel Hierarchy......Page 208 When Constructors Are Called......Page 211 Method Overriding......Page 212 Dynamic Method Dispatch......Page 215 Using Abstract Classes......Page 218 Using final with Inheritance......Page 221 The Object Class......Page 222 Packages......Page 224 Access Protection......Page 227 Importing Packages......Page 231 Interfaces......Page 233 Exception-Handling Fundamentals......Page 244 Exception Types......Page 245 Uncaught Exceptions......Page 246 Using try and catch......Page 247 Multiple catch Clauses......Page 249 Nested try Statements......Page 251 throw......Page 253 throws......Page 254 finally......Page 255 Java’s Built-in Exceptions......Page 257 Creating Your Own Exception Subclasses......Page 258 Chained Exceptions......Page 261 Three New JDK 7 Exception Features......Page 262 Using Exceptions......Page 263 Chapter 11 Multithreaded Programming......Page 264 The Java Thread Model......Page 265 The Main Thread......Page 268 Creating a Thread......Page 269 Creating Multiple Threads......Page 273 Using isAlive( ) and join( )......Page 275 Thread Priorities......Page 277 Synchronization......Page 278 Interthread Communication......Page 282 Suspending, Resuming, and Stopping Threads......Page 288 Obtaining A Thread’s State......Page 293 Using Multithreading......Page 294 Enumerations......Page 296 Type Wrappers......Page 305 Autoboxing......Page 307 Annotations (Metadata)......Page 312 I/O Basics......Page 326 Reading Console Input......Page 330 The PrintWriter Class......Page 333 Reading and Writing Files......Page 334 Automatically Closing a File......Page 340 Applet Fundamentals......Page 344 The transient and volatile Modifiers......Page 346 Using instanceof......Page 347 Native Methods......Page 349 Using assert......Page 353 Static Import......Page 356 Invoking Overloaded Constructors Through this( )......Page 358 Chapter 14 Generics......Page 362 A Simple Generics Example......Page 363 A Generic Class with Two Type Parameters......Page 369 Bounded Types......Page 371 Using Wildcard Arguments......Page 374 Creating a Generic Method......Page 381 Generic Interfaces......Page 384 Raw Types and Legacy Code......Page 386 Generic Class Hierarchies......Page 389 Type Inference with Generics......Page 396 Erasure......Page 398 Ambiguity Errors......Page 401 Some Generic Restrictions......Page 402 Part II: The Java Library......Page 406 Chapter 15 String Handling......Page 408 The String Constructors......Page 409 Special String Operations......Page 411 Character Extraction......Page 414 String Comparison......Page 415 Searching Strings......Page 419 Modifying a String......Page 421 Data Conversion Using valueOf( )......Page 423 Additional String Methods......Page 424 StringBuffer......Page 426 StringBuilder......Page 432 Chapter 16 Exploring java.lang......Page 434 Primitive Type Wrappers......Page 435 Process......Page 453 Runtime......Page 454 ProcessBuilder......Page 458 System......Page 460 Using clone( ) and the Cloneable Interface......Page 464 Class......Page 466 Math......Page 470 Thread, ThreadGroup, and Runnable......Page 473 Package......Page 481 SecurityManager......Page 482 StackTraceElement......Page 483 Enum......Page 484 The Comparable Interface......Page 485 The AutoCloseable Interface......Page 486 The java.lang Subpackages......Page 487 Chapter 17 java.util Part 1: The Collections Framework......Page 490 Collections Overview......Page 491 JDK 5 Changed the Collections Framework......Page 492 The Collection Interfaces......Page 493 The Collection Classes......Page 502 Accessing a Collection via an Iterator......Page 513 Storing User-Defined Classes in Collections......Page 517 Working with Maps......Page 519 Comparators......Page 529 The Collection Algorithms......Page 532 Arrays......Page 538 Why Generic Collections?......Page 542 The Legacy Classes and Interfaces......Page 545 Parting Thoughts on Collections......Page 561 StringTokenizer......Page 562 BitSet......Page 564 Date......Page 567 Calendar......Page 568 GregorianCalendar......Page 571 TimeZone......Page 573 SimpleTimeZone......Page 574 Locale......Page 575 Random......Page 576 Observable......Page 578 Timer and TimerTask......Page 581 Currency......Page 584 Formatter......Page 585 The ResourceBundle, ListResourceBundle, and PropertyResourceBundle Classes......Page 610 Miscellaneous Utility Classes and Interfaces......Page 614 The java.util Subpackages......Page 615 The I/O Classes and Interfaces......Page 618 File......Page 619 I/O Exceptions......Page 625 Two Ways to Close a Stream......Page 626 The Byte Streams......Page 627 The Character Streams......Page 647 The Console Class......Page 657 Serialization......Page 659 Stream Benefits......Page 665 The NIO Classes......Page 666 NIO Fundamentals......Page 667 Enhancements Added to NIO by JDK 7......Page 671 Using the NIO System......Page 677 Pre-JDK 7 Channel-Based Examples......Page 696 Networking Basics......Page 704 The Networking Classes and Interfaces......Page 705 InetAddress......Page 706 TCP/IP Client Sockets......Page 708 URL......Page 712 URLConnection......Page 713 HttpURLConnection......Page 716 TCP/IP Server Sockets......Page 718 Datagrams......Page 719 Applet Basics......Page 724 Applet Architecture......Page 727 An Applet Skeleton......Page 728 Simple Applet Display Methods......Page 730 Requesting Repainting......Page 732 The HTML APPLET Tag......Page 736 Passing Parameters to Applets......Page 738 AppletContext and showDocument( )......Page 741 Outputting to the Console......Page 743 Two Event Handling Mechanisms......Page 744 The Delegation Event Model......Page 745 Event Classes......Page 746 The KeyEvent Class......Page 752 Sources of Events......Page 756 Event Listener Interfaces......Page 757 Using the Delegation Event Model......Page 760 Adapter Classes......Page 766 Inner Classes......Page 768 Chapter 24 Introducing the AWT: Working with Windows, Graphics, and Text......Page 772 AWT Classes......Page 773 Window Fundamentals......Page 775 Working with Frame Windows......Page 776 Creating a Frame Window in an Applet......Page 778 Creating a Windowed Program......Page 784 Working with Graphics......Page 786 Working with Color......Page 792 Setting the Paint Mode......Page 794 Working with Fonts......Page 796 Managing Text Output Using FontMetrics......Page 801 Control Fundamentals......Page 810 Labels......Page 812 Using Buttons......Page 813 Applying Check Boxes......Page 816 CheckboxGroup......Page 819 Choice Controls......Page 820 Using Lists......Page 823 Managing Scroll Bars......Page 825 Using a TextField......Page 829 Using a TextArea......Page 831 Understanding Layout Managers......Page 833 Menu Bars and Menus......Page 847 Dialog Boxes......Page 853 FileDialog......Page 857 Handling Events by Extending AWT Components......Page 859 A Word About Overriding paint( )......Page 865 File Formats......Page 866 Image Fundamentals: Creating, Loading, and Displaying......Page 867 ImageObserver......Page 869 Double Buffering......Page 870 MediaTracker......Page 873 ImageProducer......Page 876 ImageConsumer......Page 878 ImageFilter......Page 881 Cell Animation......Page 894 Additional Imaging Classes......Page 897 Chapter 27 The Concurrency Utilities......Page 898 The Concurrent API Packages......Page 899 Using Synchronization Objects......Page 900 Phaser......Page 912 Using an Executor......Page 919 The TimeUnit Enumeration......Page 925 Locks......Page 926 Atomic Operations......Page 929 Parallel Programming via the Fork/Join Framework......Page 930 The Concurrency Utilities Versus Java’s Traditional Approach......Page 945 The Core Java API Packages......Page 946 Regular Expression Processing......Page 948 Reflection......Page 956 Remote Method Invocation (RMI)......Page 960 Text Formatting......Page 964 Part III: Software Development Using Java......Page 968 What Is a Java Bean?......Page 970 Introspection......Page 971 Customizers......Page 974 The Java Beans API......Page 975 A Bean Example......Page 977 The Origins of Swing......Page 982 Two Key Swing Features......Page 983 The MVC Connection......Page 984 Components and Containers......Page 985 A Simple Swing Application......Page 987 Event Handling......Page 991 Create a Swing Applet......Page 994 Painting in Swing......Page 996 JLabel and ImageIcon......Page 1002 JTextField......Page 1004 The Swing Buttons......Page 1006 JTabbedPane......Page 1014 JList......Page 1018 JComboBox......Page 1021 Trees......Page 1023 JTable......Page 1027 Continuing Your Exploration of Swing......Page 1029 Background......Page 1030 Servlet Development Options......Page 1031 Using Tomcat......Page 1032 A Simple Servlet......Page 1033 The javax.servlet Package......Page 1035 Reading Servlet Parameters......Page 1039 The javax.servlet.http Package......Page 1041 Handling HTTP Requests and Responses......Page 1047 Using Cookies......Page 1050 Session Tracking......Page 1052 Part IV: Applying Java......Page 1054 Chapter 33 Financial Applets and Servlets......Page 1056 Finding the Payments for a Loan......Page 1057 Finding the Future Value of an Investment......Page 1065 Finding the Initial Investment Required to Achieve a Future Value......Page 1069 Finding the Initial Investment Needed for a Desired Annuity......Page 1073 Finding the Maximum Annuity for a Given Investment......Page 1077 Finding the Remaining Balance on a Loan......Page 1081 Creating Financial Servlets......Page 1085 Some Things to Try......Page 1089 Understanding Internet Downloads......Page 1090 An Overview of the Download Manager......Page 1091 The Download Class......Page 1092 The ProgressRenderer Class......Page 1100 The DownloadsTableModel Class......Page 1101 The DownloadManager Class......Page 1105 Compiling and Running the Download Manager......Page 1113 Enhancing the Download Manager......Page 1114 The javadoc Tags......Page 1116 @deprecated......Page 1117 @param......Page 1118 @since......Page 1119 What javadoc Outputs......Page 1120 An Example that Uses Documentation Comments......Page 1121 Index......Page 1124 A......Page 1125 B......Page 1126 C......Page 1127 D......Page 1130 E......Page 1131 F......Page 1132 G......Page 1134 H......Page 1136 I......Page 1137 J......Page 1139 L......Page 1140 M......Page 1141 O......Page 1143 P......Page 1144 R......Page 1146 S......Page 1147 T......Page 1150 V......Page 1152 Z......Page 1153 Publisher's Note: Products purchased from Third Party sellers are not guaranteed by the publisher for quality, authenticity, or access to any online entitlements included with the product. The Definitive Java Programming GuideIn Java: The Complete Reference, Eighth Edition , bestselling programming author Herb Schildt shows you everything you need to develop, compile, debug, and run Java programs. Updated for Java Platform, Standard Edition 7 (Java SE 7), this comprehensive volume covers the entire Java language, including its syntax, keywords, and fundamental programming principles. You'll also find information on key elements of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. In addition, new Java SE 7 features such as try -with-resources, strings in switch , type inference with the diamond operator, NIO.2, and the Fork/Join Framework are discussed in detail. Coverage includes: Data types and operators Control statements Classes and objects Constructors and methods Method overloading and overriding Interfaces and packages Inheritance Exception handling Generics Autoboxing Enumerations Annotations The try -with-resources statement Varargs Multithreading The I/O classes Networking The Collections Framework Applets and servlets JavaBeans AWT and Swing The Concurrent API Much, much more The Definitive Java Programming Guide In Java: The Complete Reference, Eighth Edition , bestselling programming author Herb Schildt shows you everything you need to develop, compile, debug, and run Java programs. Updated for Java Platform, Standard Edition 7 (Java SE 7), this comprehensive volume covers the entire Java language, including its syntax, keywords, and fundamental programming principles. You'll also find information on key elements of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. In addition, new Java SE 7 features such as try -with-resources, strings in switch , type inference with the diamond operator, NIO.2, and the Fork/Join Framework are discussed in detail. Coverage includes: Data types and operators Control statements Classes and objects Constructors and methods Method overloading and overriding Interfaces and packages Inheritance Exception handling Generics Autoboxing Enumerations Annotations The try -with-resources statement Varargs Multithreading The I/O classes Networking The Collections Framework Applets and servlets JavaBeans AWT and Swing The Concurrent API Much, much more The Definitive Java Programming Guide In Java: The Complete Reference, Eighth Edition, bestselling programming author Herb Schildt shows you everything you need to develop, compile, debug, and run Java programs. Updated for Java Platform, Standard Edition 7 (Java SE 7), this comprehensive volume covers the entire Java language, including its syntax, keywords, and fundamental programming principles. You'll also find information on key elements of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. In addition, new Java SE 7 features such as try -with-resources, strings in switch, type inference with the diamond operator, NIO. 2, and the Fork/Join Framework are discussed in detail. Coverage includes: Data types and operators Control statements Classes and objects Constructors and methods Method overloading and overriding Interfaces and packages Inheritance Exception handling Generics Autoboxing Enumerations Annotations The try -with-resources statement Varargs Multithreading The I/O classes Networking The Collections Framework Applets and servlets JavaBeans AWT and Swing The Concurrent API Much, much more In Java: The Complete Reference[TM], Eighth Edition, bestselling programming author Herb Schildt shows you everything you need to develop, compile, debug, and run Java programs. Updated for Java Platform, Standard Edition 7 (Java SE 7), this comprehensive volume covers the entire Java language, including its syntax, keywords, and fundamental programming principles. You'll also find information on key elements of the Java API library. JavaBeans, servlets, applets, and Swing are examined and real-world examples demonstrate Java in action. In addition, new Java SE 7 features such as try-with-resources, strings in switch, type inference with the diamond operator, NIO.2, and the Fork/Join Framework are discussed in detail