Since Java 10 it has become possible to infer types for the variables automatically by using var. // stream will have the FileOutputStream type as inferred from its initializer var stream = new FileOutputStream("file.txt"); // An equivalent declaration with an explicit type FileOutputStream stream = new FileOutputStream("file.txt"); Code blocks The separators and } signify a code block and a new scope. Class members and the body of a method are examples of what can live inside these braces in various contexts. Inside of method bodies, braces may be used to create new scopes, as follows: void doSomething() { int a; { int b; a = 1; } a = 2; b = 3; // Illegal because the variable b is declared in an inner scope.. } Comments Java has three kinds of comments: traditional comments, end-of-line comments and documentation comments. Traditional comments, also known as block comments, start with /* and end with */, they may span across multiple lines. This type of comment was derived from C and C++. /* This is a multi-line comment. It may occupy more than one line. */ End-of-line comments start with // and extend to the end of the current line. This comment type is also present in C++ and in modern C. // This is an end-of-line comment Documentation comments in the source files are processed by the Javadoc tool to generate documentation. This type of comment is identical to traditional comments, except it starts with /** and follows conventions defined by the Javadoc tool. Technically, these comments are a special kind of traditional comment and they are not specifically defined in the language specification. /** * This is a documentation comment. * * @author John Doe */ Universal types Classes in the package java.lang are implicitly imported into every program, as long as no explicitly-imported types have the same names. Important ones include: java.lang.Object Java's top type. Superclass of all classes that do not declare a parent class. All values can be converted to this type, although for primitive values this involves autoboxing. java.lang.String Java's basic string type. Immutable. Some methods treat each UTF-16 code unit as a "character", but methods to convert to an int[] that is effectively UTF-32 are also available. java.lang.Throwable supertype of everything that can be thrown or caught with Java's throw and catch statements. Program structure Java applications consist of collections of classes. Classes exist in