一 、安装jdk9
方法一
sudo apt install openjdk-9-jdk-headless
方法二
下载jdk9:
hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9cd openjdk9 && sh ./get_source.sh
# 编译
bash ./configure# make
make all cd build/linux-x86_64-normal-server-release/images/# 使用jshell
jdk/bin/jshell二 、试验Jshell
打印一个hello world
试验了一下Calendar类
# dpc @ dpc-thinkpad in /export/service/kulla-dev/openjdk9/build/linux-x86_64-normal-server-release/jdk [22:20:23] $ bin/jshell | Welcome to JShell -- Version 9-internal| For an introduction type: /help introjshell> System.out.println("hello world")hello worldjshell> CalCalendar Callable jshell> CalCalendar Callable jshell> Calendar.getgetAvailableCalendarTypes() getAvailableLocales() getInstance( jshell> Calendar.getInstance(getInstance( jshell> Calendar.getInstance()$2 ==> java.util.GregorianCalendar[time=1476195674501,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=19,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2016,MONTH=9,WEEK_OF_YEAR=42,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR=285,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=10,HOUR_OF_DAY=22,MINUTE=21,SECOND=14,MILLISECOND=501,ZONE_OFFSET=28800000,DST_OFFSET=0]jshell> Calendar.getInstance().get(Display all 447 possibilities? (y or n)jshell> Calendar.getInstance().get(Cal)Calendar Callable jshell> Calendar.getInstance().get(Calendar.D)DATE DAY_OF_MONTH DAY_OF_WEEK DAY_OF_WEEK_IN_MONTH DAY_OF_YEAR DECEMBER DST_OFFSET jshell> Calendar.getInstance().get(Calendar.DA)DATE DAY_OF_MONTH DAY_OF_WEEK DAY_OF_WEEK_IN_MONTH DAY_OF_YEAR jshell> Calendar.getInstance().get(Calendar.DAY_OF_)DAY_OF_MONTH DAY_OF_WEEK DAY_OF_WEEK_IN_MONTH DAY_OF_YEAR jshell> Calendar.getInstance().get(Calendar.DAY_OF_WEEK)DAY_OF_WEEK DAY_OF_WEEK_IN_MONTH jshell> Calendar.getInstance().get(Calendar.DAY_OF_WEEK))$3 ==> 3jshell> Calendar.getInstance().get(Calendar.DAY_OF_MONTH)$4 ==> 11jshell> Calendar.getInstance().get(Calendar.DAY_OF_YEAR)$5 ==> 285jshell> Calendar.getInstance().get(Calendar.HOUR)HOUR HOUR_OF_DAY jshell> Calendar.getInstance().get(Calendar.HOUR))$6 ==> 10
留图纪念。
有了这玩意以后忘记哪个语法了,或者临时做个小测试,验证个小思路,sublist,subStr这样子的,不用再费劲建个class了。