Raja has Published 760 Articles

What are the different "/edit" commands in JShell in Java 9?

raja

raja

Updated on 14-Apr-2020 18:13:27

170 Views

JShell is a command-line tool introduced in Java 9 that evaluates declarations, statements, and expressions without the main() method. JShell can set up a text editor called JShell Edit Pad, which allows us to modify the code very easily, and it can be launched using the "/edit" command.Below are the different ... Read More

How to get JShell documentation in Java 9?

raja

raja

Updated on 14-Apr-2020 15:06:30

252 Views

Java 9 introduced a new interactive tool called JShell. This tool can be used to execute expressions, classes, interfaces, enums, and etc.The detailed documentation can be available in JShell with full information, as well as the use of its internal commands with the various options. This documentation can be accessed ... Read More

What are the steps to execute Flow API in Java 9?

raja

raja

Updated on 14-Apr-2020 13:01:43

224 Views

Flow API in Java 9 corresponds to Reactive Streams specification, which is a defacto standard. It contains a minimal set of interfaces that capture the heart of asynchronous publication and subscription.Below are the key interfaces of Flow API:1) Flow.Publisher: It produces items for subscribers to consume, and it contains only method: subscribe(Subscriber), ... Read More

How can we implement Flow API using Publisher-Subscriber in Java 9?

raja

raja

Updated on 14-Apr-2020 10:31:19

1K+ Views

Flow API (java.util.concurrent.Flow) has introduced in Java 9. It helps to understand different ways in which the Publisher and Subscriber interfaces interact to perform desired operations.Flow API consists of Publisher, Subscriber, Subscription, and Processor interfaces, which can be based on reactive stream specification.In the below example, we can implement Flow API by ... Read More

How can we customize the start of JShell in Java 9?

raja

raja

Updated on 13-Apr-2020 17:42:19

137 Views

JShell is an interactive REPL tool to execute and evaluate simple Java programs like variable declarations, statements, expressions, and etc.When the JShell tool launched, the code has pre-loaded by default. To display this code, we just launch the command "/list -start". It is possible to ask JShell to load them automatically when ... Read More

How can we implement the Subscriber interface in Java 9?

raja

raja

Updated on 13-Apr-2020 13:51:04

621 Views

Java 9 supports to create Reactive Streams by introducing a few interfaces: Publisher, Subscriber, Subscription, and SubmissionPublisher class that implements the Publisher interface. Each interface can play a different role corresponding to the principles of Reactive Streams.We can use the Subscriber interface to subscribe to the data that is being published by a publisher. We ... Read More

How to modify the default editor of JShell in Java 9?

raja

raja

Updated on 13-Apr-2020 09:12:48

384 Views

JShell implements REPL (Read-Evaluate-Print Loop) that reads the code from the command-line, evaluates the given snippet, and prints the result back to us.In JShell, it's possible to edit code from the default JShell editor by using JShell Editor Pad. We can also use the "/set" command to modify the default editor in ... Read More

How can we modify an existing module in Java 9?

raja

raja

Updated on 10-Apr-2020 17:24:53

423 Views

The module is a named, self-describing collection of code and data. The code has been organized as a set of packages containing types like Java classes and interfaces. The data includes resources and other kinds of static information. We need to declare a module then add module-info.java at the root of ... Read More

What are the different "/vars" commands in JShell in Java 9?

raja

raja

Updated on 10-Apr-2020 13:48:38

324 Views

JShell is an interactive command-line tool introduced in Java 9. It is also called a REPL tool that takes input, evaluates it, and prints output to the user.In the JShell tool, it's possible to list all variables created by using the internal command "/vars". We have different "/vars" commands available in the ... Read More

How can we create a Service Provider interface in Java 9?

raja

raja

Updated on 10-Apr-2020 12:19:26

196 Views

A module that provides the implementation for the Service interface contains a "provides" statement in the module descriptor file. If the module doesn’t have the "provides" statement in the module descriptor file, the service loader can't load that module.We can create the Service Provider Interface by using below steps:We create a ... Read More

Advertisements