Java 9
12 OctoberJava 9 JShell tutorial
The Java JShell is a command-line tool that is introduced in Java 9 version. It helps to execute/test Java statements in a single line. [toc] It is based on REPL (Read Evaluate Print Loop) that reads a code statement, execute that and print the output, statement after statement. It reads the statement and immediately shows […]
11 OctoberJava 9: Stream API Improvements
In Java 9, following methods are added to Stream interface of stream package. These methods are default and static. [toc] The takeWhile() Method This method is included in Stream interface and used to collect the elements into a stream. It takes all the elements till the condition specified as predicate. For example, we want to […]
24 SeptemberJava 9 – Process API Improvements
In this post, we will see about Java 9 process API improvements. [toc] Java improved its Process API in Java 9 version that includes new methods for Process class and two new interfaces ProcessHandle and ProcessHandle.Info. These methods are used to create a new process and get process information like process status, running time, process […]
19 SeptemberJava try with resources
In this post, we will see about Java try with resources Statement. [toc] Java try with resources is a feature of Java which was added into Java 7. It helps to close all the resources declared within try block. It automatically closes the resources after being used. A resource can be any file or a […]
19 SeptemberJava 9 – Javadoc Improvement
Java has upgraded its Javadoc for better user interaction and user-experience. It includes a simplified search, HTML generator, Doclet API, etc. [toc] What is Javadoc The Javadoc is a tool like javac and a part of JDK. It is used to generate HTML documentation of Java source code. If you ever visit to oracle site […]
19 SeptemberJava 9 – @SafeVarargs Annotation
In this post, we will see about @SafeVarargs Annotation in Java 9. [toc] The @SafeVarargs is an annotation that is used to perform safe operations. When a method takes variable arguments, then it may cause to unsafe operation, so the @SafeVarargs annotation tells to the compiler to perform safe operations. For example, if we don’t […]
19 SeptemberJava 9 – Anonymous Inner classes and Diamond Operator
Type inference is a feature of Java that was introduced in Java 7. Now, Java compiler can infer type of a data automatically. For example, if we create an ArrayList then we use the code like: List list = new ArrayList(); // Before Java 7 List list = new ArrayList(); // From Java 7 and […]
19 SeptemberJava 9 – Private methods in interface
In this topic, we will discuss the private and private static methods inside an interface. [toc] interface in Java is a concept which is used to achieve abstraction. In early versions of Java, an interface can contain only abstract methods and constants until Java 8 which allows to add default and static methods as well. […]
17 SeptemberJava 9 Underscore(_) keyword
In this post, we will see about Underscore keyword, which is introduced in java 9. [toc] Underscore In Java Underscore(_) is a symbol that is used to combine multi-words in a single identifier sometimes refers to a variable in a programming context. In Java, to create a lengthy variable, we prefer to use underscore (_) […]