By Guess Blogger Deepak Vohra
Java Shell (or JShell) is a new tool introduced in Java 9 for running standalone code snippets. JShell in NetBeans is explored in six articles. The first article introduces JShell with NetBeans including how to access the JShell. JShell-only commands such as /list and /save are shell commands to facilitate the use of the tool. The first article discusses how to run code snippets to import a package or a type. Further, the first article discusses declaring and using variables explicitly.
The second article continues with declaring and using variables; implicit variables. Further, code snippets for String comparison and statements are run in the second article. Resetting JShell is also discussed in the second article.
The third article is all about running code snippets for methods in JShell. Modifying method definition, method overloading, and making a forward reference to a method are discussed as used in JShell. Some JShell specific features for methods are also discussed including listing code snippets for methods, and method modifiers not permitted in a top-level method declaration.
The fourth article is mainly about running code snippets for classes in JShell including declaring a class, modifying a class, using class constructors, extending a class and overriding methods. Further, interfaces, arrays and unchecked exceptions are also discussed.
The fifth article discusses running code snippets for enums and the various control flow statements.
The sixth article discusses lambda expressions, in addition to discussing saving and loading code snippets in JShell.