| [ Web Proxy ] |
| Viewing: https://riptutorial.com/java/example/29408/expressions | [Back] [Original] |
[logo rip]
Within JShell, you can evaluate Java expressions, with or without semicolons. These can range from basic expressions and statements to more complex ones:
jshell> 4+2
jshell> System.out.printf("I am %d years old.\n", 421)
Loops and conditionals are fine, too:
jshell> for (int i = 0; i<3; i++) {
...> System.out.println(i);
...> }
It is important to note that expressions within blocks must have semicolons!
| Web Proxy Viewer | New URL | Original Page |