Raja has Published 760 Articles

How to implement String utility and immutability in JShell in Java 9?

raja

raja

Updated on 27-Apr-2020 18:01:09

53 Views

JShell is an interactive command-line tool used to implement simple statements like expressions, classes, methods, fields, interfaces, and etc. String class is part of the built-in java.lang package and provides several methods for common text processing.1) String Utility: String provides several built-in utility methods. The methods like indexOf(), lastIndexOf(), startsWith(), endsWith(), ... Read More

What are the rules we need to follow in JShell in Java 9?

raja

raja

Updated on 27-Apr-2020 12:18:03

130 Views

Java 9 introduced an interactive REPL (Read-Evaluate-Print-Loop) tool: JShell, and it allows us to execute code snippets and get an immediate result. A snippet is an instruction that can use standard Java syntax. It represents a single expression, statement, or declaration.Below are some of the rules we need to follow while ... Read More

How to declare reference types in JShell in Java 9?

raja

raja

Updated on 24-Apr-2020 19:46:37

121 Views

JShell is an interactive tool in Java 9 that allows user inputs, evaluates it, and prints output to the user.Unlike a value type, a reference type doesn't store its value directly. Instead, it will store the address where a value is stored. It means that a reference type contains a pointer ... Read More

What is the use of the jdeprscan tool in Java 9?

raja

raja

Updated on 24-Apr-2020 17:33:05

198 Views

The jdeprscan tool can be used for static analysis of classes, archives, and folders for the presence of API elements marked as deprecated. This tool only detects items marked as deprecated in Java SE, and it doesn't detect marked items in other libraries. All classes on which the examined class or set of classes ... Read More

How to initialize an array in JShell in Java 9?

raja

raja

Updated on 24-Apr-2020 16:43:30

291 Views

JShell is a command-line tool used to evaluate simple statements, expressions, classes, methods, variables, etc.. and prints the output immediately to the user.An array in Java is also an object. We need to declare an array and then created. In order to declare a variable that holds an array of integers, ... Read More

How to create wrapper objects in JShell in Java 9?

raja

raja

Updated on 24-Apr-2020 14:18:37

205 Views

Each primitive type in Java has a corresponding built-in wrapper class, and these wrapper classes are also immutable. Integer, Float, Double, Byte, and etc.. are some of the built-in wrapper classes. The main incentive of using such wrappers in our code is accessing type information about the corresponding primitive type, ... Read More

How to show reflection frames of StackFrame in Java 9?

raja

raja

Updated on 24-Apr-2020 10:22:23

126 Views

A standard API has been provided in Java 9 using java.lang.StackWalker class. This class designed to be efficient by allowing lazy access to the stack frames. A couple of other options allow in a stack trace that includes implementation and/or reflection frames, and it can be useful for debugging purposes. For ... Read More

How to skip certain classes in StackFrame in Java 9?

raja

raja

Updated on 24-Apr-2020 09:20:53

148 Views

StackWalker API has been introduced in Java 9, and it gives a snapshot of the stack trace of current thread at any given point of time and has methods to walk over it. The advantage of using StackWalker class over Thread::getStackTrace() is to filter or skip certain classes and get the instance of ... Read More

How to define a switch statement in JShell in Java 9?

raja

raja

Updated on 23-Apr-2020 18:43:42

109 Views

JShell is based on the REPL (Read-Evaluate-Print-Loop) introduced in Java 9. This tool can be used to execute simple statements, evaluate it, and prints the result.A switch statement can test multiple conditions just like an else clause and handles the default possibility. The default clause can be executed when none of the ... Read More

How to use terminal stream operations in JShell in Java 9?

raja

raja

Updated on 23-Apr-2020 14:28:12

169 Views

JShell is an interactive tool that takes simple statements, expressions and etc.. as input, evaluates it, and prints the result immediately to the user.Terminal Operation is a stream operation that takes a stream as input and doesn't return any output stream. For instance, a terminal operation can be applied to a lambda expression and ... Read More

Advertisements