Java9 was included, so I tried jshell.

――I didn't care, but java9 was included in eclipse. ――I'm not sure about the new function itself, but I tried it because jshell became available.

--Enter with the jshell command and exit with / exit```.

sh-3.2$ pwd
/Applications/Eclipse_4.7.2.app/Contents/java/9/Home/bin
sh-3.2$ ./jshell
|Welcome to JShell--Version 9.0.1
|For an overview, type:: /help intro

jshell> System.out.println("HELLO WORLD!")
HELLO WORLD!

jshell> List<String> list = new ArrayList<>()
list ==> []

jshell> list.add("HELLO")
$3 ==> true

jshell> list.add("WORLD")
$4 ==> true

jshell> list
list ==> [HELLO, WORLD]

jshell> String.join("-",list)
$6 ==> "HELLO-WORLD"

jshell> /exit
|Finish

Try using it lightly

――You don't need import java.util.List. Is ```import java.util. * `` `Implicit declaration? ――Isn't it nice to be able to easily see the contents of variables?

Let's take a look at pid.

sh-3.2$ ./jshell
|Welcome to JShell--Version 9.0.1
|For an overview, type:: /help intro

jshell> ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
|error:
|Can't find symbol
|symbol:Variable ManagementFactory
|place:class
|  ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
|  ^---------------^

jshell> import java.lang.management.ManagementFactory

jshell> ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
$2 ==> "4449"

――On the other hand, in ps, it is as below.

sh-3.2$ ps
  PID TTY           TIME CMD
 4448 ttys000    0:08.22 ./jshell
 4449 ttys000    0:00.60 /Applications/Eclipse_4.7.2.app/Contents/java/9/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=localhost:64584 jdk.jshell.execution.R

Recommended Posts

Java9 was included, so I tried jshell.
I tried Drools (Java, InputStream)
I tried using Java REPL
I tried metaprogramming in Java
Java SE 13 (JSR388) has been released so I tried it
I tried to interact with Java
I tried UDP communication with Java
I tried the Java framework "Quarkus"
I tried using Java8 Stream API
I tried using JWT in Java
I tried to summarize Java learning (1)
I tried to summarize Java 8 now
I tried using Java memo LocalDate
I tried using GoogleHttpClient of Java
Java14 came out, so I tried record for the time being
I was curious about how gRPC-Java works, so I tried code reading
I tried using Elasticsearch API in Java
I tried Cassandra's Object Mapper for Java
I tried to summarize Java lambda expressions
I tried the new era in Java
I tried using OpenCV with Java + Tomcat
I tried Google's entrance exam (unofficial) [java]
I tried putting Java on my Mac easily
java I tried to break a simple block
I tried hitting a Java method from ABCL
I tried to implement deep learning in Java
I tried Spring.
I tried tomcat
Why Java was the target language I hate
Studying java9 (jShell)
I tried to output multiplication table in Java
I tried youtubeDataApi.
I tried refactoring ①
I tried to create Alexa skill in Java
I tried FizzBuzz.
I tried to break a block with java (1)
I tried running Java on a Mac terminal
I tried JHipster 5.1
When I tried to unit test with IntelliJ, I was told "java.lang.OutOfMemoryError: Java heap space"
I tried Java Lambda input / output type ~ POJO edition ~
I tried Mastodon's Toot and Streaming API in Java
AWS Lambda supports container images so I tried Puppeteer
I tried to implement TCP / IP + BIO with JAVA
I tried to implement Firebase push notification in Java
[Java 11] I tried to execute Java without compiling with javac
I tried using Google Cloud Vision API in Java
[Java] I tried to solve Paiza's B rank problem
I tried to operate SQS using AWS Java SDK
# 2 [Note] I tried to calculate multiplication tables in Java.
I tried Java Lambda input / output type ~ Stream version ~
I tried to create a Clova skill in Java
I tried to make a login function in Java
I tried using Log4j2 on a Java EE server
I tried calling Java / Objective-C native code from Flutter
I tried OCR processing a PDF file with Java
I tried to implement Stalin sort with Java Collector
[Java] I tried to implement Yahoo API product search
I tried using an extended for statement in Java
I tried passing Java Silver in 2 weeks without knowing Java
I tried to implement the Euclidean algorithm in Java
~ I tried to learn functional programming in Java now ~