Raja has Published 760 Articles

How to create JShell instance programmatically in Java 9?

raja

raja

Updated on 04-Mar-2020 14:06:19

326 Views

JShell is an interactive tool introduced since Java 9. It is Java's first official REPL tool to create a simple programming environment in the command-line that reads the user's inputs, evaluates it, and prints the result.We can able to create a new JShell instance programmatically in Java language. JShell and its associated APIs ... Read More

What are the different shortcut keys in JShell in Java 9?

raja

raja

Updated on 04-Mar-2020 12:19:49

352 Views

JShell is an interactive tool that allows us to execute the java code and getting immediate results. We quickly evaluate expressions or short algorithms without compiling or build it. We can execute expressions, classes, methods, variables,  and etc with the help of the JShell tool.Below are some of the keyboard shortcut ... Read More

What is Project Jigsaw in Java 9?

raja

raja

Updated on 04-Mar-2020 08:16:00

711 Views

The primary objective of the Jigsaw project is to introduce the modularity concept to create a module in Java 9 and then applying the same to JDK.Below are some of the benefits of Modularity(Jigsaw)Strong Encapsulation: The modules can access only those parts that can be available for use. Unless the ... Read More

When to use the readNBytes() method of InputStream in Java 9?

raja

raja

Updated on 03-Mar-2020 14:12:22

1K+ Views

Since Java 9, the readNBytes() method can be added to the InputStream class. This method reads the requested number of bytes from an input stream into the given byte array. This method blocks until len bytes of input data have read, end of a stream is detected, or an exception ... Read More

What are the different compilation modes of a module in Java 9?

raja

raja

Updated on 03-Mar-2020 08:35:30

210 Views

A module is a container of packages and each module contains a module descriptor that includes module name, module dependencies,  it means that the name of other modules depends on and name of the packages it exports that can be used only by modules that depend on it.module com.tutorialspoint.app {    /** Modules ... Read More

How to declare a class and an interface in JShell in Java 9?

raja

raja

Updated on 03-Mar-2020 05:46:13

259 Views

JShell can provide an interactive shell for quickly prototyping, debugging, and learning Java and Java API without the need for the main() method or need to compile our code before executing it.Declaration of Class:We can declare a class just like we have written a code in Java Language. The JShell can ... Read More

When to use the readAllBytes() method of InputStream in Java 9?

raja

raja

Updated on 28-Feb-2020 19:23:12

7K+ Views

Since Java 9, we can use the readAllBytes() method from InputStream class to read all bytes into a byte array. This method reads all bytes from an InputStream object at once and blocks until all remaining bytes have read and end of a stream is detected, or an exception is thrown.The ... Read More

How to get dates using LocalDate.datesUntil() method in Java 9?

raja

raja

Updated on 28-Feb-2020 11:37:48

1K+ Views

The LocalDate.datesUntil() method creates a stream between two local date instances and allows us to optionally specify a step size. This method has two variations, the first one takes end date and gives a list of dates between the current date and end date whereas the second one takes a Period object as a ... Read More

How to get the date and time in JShell in Java 9?

raja

raja

Updated on 28-Feb-2020 08:57:04

362 Views

JShell is an interactive command-line tool that can allow us to learn, investigate, and explore the Java language and their API. We can type any valid java code into the console and get immediate results without the need to write a verbose class with the main() method.If we want to get the ... Read More

How to use the collect() method in Stream API in Java 9?

raja

raja

Updated on 27-Feb-2020 13:40:16

1K+ Views

The collect() method in Stream API collects all objects from a stream object and stored in the type of collection. The user has to provide what type of collection the results can be stored. We specify the collection type using the Collectors Enum. There are different types and different operations ... Read More

Advertisements