- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2616 Articles for Java
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
357 Views
Http/2 Client API introduced in Java 9. It has more performance improvements over Http/1.1 and also supports server-side push events. This makes the website efficient and faster to browse. Http/2 Client is an incubator module named jdk.incubator.httpclient, which means that all features are still not finalized, and new changes may come in future versions of java. It exports jdk.incubator.http package that contains all public APIs.To use Http/2 Client, we need to use the incubator module, we simply pass the httpclient module into JShell using the "–add-modules" command as belowC:\>jshell -v --add-modules jdk.incubator.httpclient | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help introExamplejshell> import jdk.incubator.http.*; jshell> HttpClient httpClient ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
246 Views
JShell is a REPL tool that allows snippets of code to be run without placing them in classes. This tool provides a way to evaluate declarations, statements, and expressions in Java and no need to create the main() method to test some parts of the code.The command "/debug" can be used to display debugging information for the JShell tool implementation. Once we type the "/debug" command, the debugging mode is on. After enabling the debug mode and type something like a simple addition, or a simple string, then it prints as below.Example-1jshell> /debug | Debugging on jshell> 5+3 Compiling: 5+3 Kind: EXPRESSION_STATEMENT ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
248 Views
JShell is Java’s first official REPL application introduced in Java 9. It is a tool that helps in executing and evaluating simple java programs, and small logics such as statements, simple programs, loops, expressions, etc. Java REPL can provide a simple programming environment in a command-line prompt. It reads the input, evaluates it, and prints the output.In the below example, we can implement a string with pre-defined methods of String class.Examplejshell> String str = "{abcd}"; str ==> "{abcd}" jshell> str.substring(2, str.length() - 1) $7 ==> "bcd" jshell> String s1 = new String("abcd"); s1 ==> "abcd" jshell> String s2 ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
418 Views
Java 9 can provide a common logging system for JVM components with a detailed level. By using a new command-line option: -Xlog for all logging settings and unified JVM logging gives us an easy-to-configure tool to do a root cause analysis (RCA) of complex system-level JVM components.The command line -Xlog can be used for controlling all logging JVM components. The arguments of -Xlog follow the below rules:Multiple arguments have applied in the order they appear in the command-line.Last configuration rules: for the same output, multiple arguments can override each other in the given order.Xlog: disable turns off all logging and clears all configuration of the ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
413 Views
Internationalization enhancements for Java 9 include enabling of CLDR Locale Data by Default.There are four distinct sources for locale data identified by using the below keywords:CLDR: The locale data provided by a Unicode Common Locale Data Repository (CLDR) project.HOST: The current user’s customization of an underlying operating system’s settings. Depending on the operating system, formats like date, time, number, and currency can be supported.SPI: The locale-sensitive services implemented in installed SPI providers.COMPAT (JRE): The locale data that is compatible with releases prior to Java 9. The JRE can still be used as a value but deprecated, and removed in the future.In Java ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
510 Views
Since Java 9, versioning can be consistent with semantic versioning. The version number can be a non-empty sequence of strings separated by dots. It contains three major parts: major version number, minor version number, and security. The new versioning scheme has documented in Runtime. Version class and version information can be accessed from it.The version numbers have the below format:$MAJOR.$MINOR.$SECURITY(.$otherpart)?$MAJOR is the major version number and incremented when a major version has released that typically changes the platform specification. For JDK 9, this value is 9.$MINOR is the minor version number and incremented for releases that contain bug fixes and enhancements to ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
283 Views
JShell is an interactive Java Shell tool that enables us to execute java code from the shell and instantly displays the output. JShell is the REPL(Read Evaluate Print Loop) tool that runs from the command-line. We can start a JShell by simply typing "jshell" in the command prompt, and to exit the jshell by using "/exit" command. For small snippets, we do not need to create a main() method in JShell.We can also implement the major collections like list, map and set by using this tool. In the below program, we can implement an ArrayList with various scenarios.ExampleC:\Users\User\Desktop\Java 9 QNA>jshell | Welcome to JShell ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
215 Views
In Java 9, Platform Logging API can be used to log messages with a service interface for consumers of those messages. An implementation of LoggerFinder has been loaded with the help of java.util.ServiceLoader API by using System ClassLoader. Based on this implementation, an application can plug in its own external logging backend without configuring java.util.logging.We can pass a class name or module to LoggerFinder so that it knows which logger to return.public class MyLoggerFinder extends LoggerFinder { @Override public Logger getLogger(String name, Module module) { // return a logger depends on name/module } }If no concrete implementation can be found, then ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
240 Views
StackWalker API provides a stream of information in stack traces during the execution of a program. This API requires a virtual machine to capture a snapshot of the entire stack and returns an array of elements for filtering purposes. We need to skip, drop, and limit the stack frames by using the walk() method. We can also filter a stack frame by class for getting the first matching frame, and all matching frames by using the filter() method.In the below example, we can filter a stack frame by using StackWalker API.Exampleimport java.lang.StackWalker.StackFrame; import java.util.*; import java.util.stream.*; public class StackWalkerFilterTest { ... Read More
![raja](https://www.tutorialspoint.com/assets/profiles/107595/profile/60_161286-1564642329.jpg)
186 Views
Java 9 defines a StackWalker API that provides laziness and frame filtering. An object of StackWalker allows us to traverse and access stacks and contains one useful method: walk(). This method opens a StackFrame stream for the current thread, then applies the function with that StackFrame stream. We need to get StackWalker object, then use StackWalker.getInstance() method.In the below example, we can print different stack frames: all stack frames, skip some stack frames and limit stack frames by using StackWalker API.Exampleimport java.lang.StackWalker.StackFrame; import java.util.*; import java.util.stream.*; public class StackWalkerTest { public static void main(String args[]) { new StackWalkerTest().walk(); } private void walk() { ... Read More