 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to print the pattern of stars in JShell in Java 9?
JShell is a REPL tool introduced in Java 9 that allows us to execute Java code and getting results immediately. We can evaluate expressions or simple algorithms without creating a new project, compile or build it by using JShell. We can also execute expressions, use imports, define classes, methods, and variables. It is a part of Java 9 JDK but not JRE.
We can start JShell session in command-prompt by simply typing jshell. We can use different commands: /exit to quit the JShell session, reset/reload JShell anytime by typing /reset, and /reload, /import to list the imports, etc.
In the below example, we can print the stars in JShell by using the "for" loop.
C:\Users\User>jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> for(int i=0; i<10; i++) { ...>       for(int j=0; j<=i; j++) ...>       System.out.print("*"); ...>       System.out.println(""); ...>    } * ** *** **** ***** ****** ******* ******** ********* **********Advertisements
 