您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何在Java 9的JShell中打印星星的图案?

2025/6/8 14:23:05发布16次查看
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 introjshell> for(int i=0; i<10; i++) {...> for(int j=0; j<=i; j++)...> system.out.print("*");...> system.out.println("");...> }*******************************************************
以上就是如何在java 9的jshell中打印星星的图案?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product