Java 8 Pocket Guide
Robert Liguori, Patricia Liguori
Language: English
Pages: 242
ISBN: 1491900865
Format: PDF / Kindle (mobi) / ePub
When you need quick answers for developing or debugging Java programs, this pocket guide provides a handy reference to standard features of the Java programming language and its platform. You’ll find helpful programming examples, tables, figures, and lists, as well as Java 8 features such as Lambda Expressions and the Date and Time API. It’s an ideal companion, whether you’re in the office, in the lab, or on the road.
This book also provides material to help you prepare for the Oracle Certified Associate Java Programmer exam.
- Quickly find Java language details, such as naming conventions, types, statements and blocks, and object-oriented programming
- Get details on the Java SE platform, including development basics, memory management, concurrency, and generics
- Browse through information on basic input/output, NIO 2.0, the Java collections framework, and the Java Scripting API
- Get supplemental references to fluent APIs, third-party tools, and basics of the Unified Modeling Language (UML)
exception was thrown all the way back to where it was caught and handled: java.io.FileNotFoundException: file.js (The system cannot find the file specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(init) (FileInputSteam.java:106) at java.io.FileInputStream.(init) (FileInputSteam.java:66) at java.io.FileReader(init)(FileReader.java:41) at EHExample.openFile(EHExample.java:24) at EHExample.main(EHExample.java:15) Printing Information About Exceptions | 81
arguments, will cause the help information for the javac command to be printed. Java Interpreter The Java interpreter handles the program execution, including launching the application. Here is a list of commonly used inter‐ preter options. java [-options] class [arguments…] Runs the interpreter. java [-options] –jar jarfile [arguments…] Executes a JAR file. java HelloWorld Starts the JRE, loads the class HelloWorld, and runs the main method of the class. java com.oreilly.tutorial.HelloWorld
constant-values.html, deprecated-list.html, overviewtree.html, package-summary.html, etc. javadoc –verbose HelloWorld.java The –verbose option provides more details while Javadoc is running. javadoc –d /tmp/ HelloWorld.java This –d option specifies the directory where the generated HTML files will be extracted to. Without this option, the files will be placed in the current working directory. javadoc –sourcespath /Classes/ Test.java The –sourcepath option specifies where to find user .java
and [g|G] for gigabytes. Note that –XX options are not guaranteed to be stable. They are not part of the Java Language Specification (JLS) and are unlikely to be available in exact form and function from other third-party JVMs, if at all. Resizing the JVM Heap The heap is an area in memory that stores all objects created by executing a Java program. You should resize the heap only if it needs to be sized larger than the default heap size. If you are hav‐ ing performance problems or seeing the
= 9.15f, floatValue2 = 1_168f; Float floatValue3 = new Float(20F); double doubleValue1 = 3.12; Double doubleValue2 = new Double(1e058); float expValue1 = 10.0e2f, expValue2=10.0E3f; String Literals String literals contain zero or more characters, including escape sequences enclosed in a set of double quotes. String literals can‐ not contain Unicode \u000a and \u000d for line terminators; use \r and \n instead. Strings are immutable: String String String String stringValue1 stringValue2