- Java 9 Programming Blueprints
- Jason Lee
- 134字
- 2021-07-02 18:56:27
REPL
One change that seems to excite a lot of people isn't a language change at all. It's the addition of a REPL (Read-Eval-Print-Loop), a fancy term for a language shell. In fact, the command for this new tool is jshell. This tool allows us to type or paste in Java code and get immediate feedback. For example, if we wanted to experiment with the Streams API discussed in the preceding section, we could do something like this:
$ jshell | Welcome to JShell -- Version 9-ea | For an introduction type: /help intro jshell> List<String> names = Arrays.asList(new String[]{"Tom", "Bill", "Xavier", "Sarah", "Adam"}); names ==> [Tom, Bill, Xavier, Sarah, Adam] jshell> names.stream().sorted().forEach(System.out::println); Adam Bill Sarah Tom Xavier
This is a very welcome addition that should help Java developers rapidly prototype and test their ideas.
推薦閱讀
- Visual Basic .NET程序設(shè)計(jì)(第3版)
- WildFly:New Features
- Java范例大全
- Windows系統(tǒng)管理與服務(wù)配置
- 精通軟件性能測(cè)試與LoadRunner實(shí)戰(zhàn)(第2版)
- UML+OOPC嵌入式C語言開發(fā)精講
- 單片機(jī)應(yīng)用技術(shù)
- jQuery開發(fā)基礎(chǔ)教程
- JAVA程序設(shè)計(jì)實(shí)驗(yàn)教程
- Apache Kafka Quick Start Guide
- Python深度學(xué)習(xí)原理、算法與案例
- Statistical Application Development with R and Python(Second Edition)
- Illustrator CC平面設(shè)計(jì)實(shí)戰(zhàn)從入門到精通(視頻自學(xué)全彩版)
- IoT Projects with Bluetooth Low Energy
- 大學(xué)計(jì)算機(jī)基礎(chǔ)實(shí)訓(xùn)教程