| 1 |
--- |
| 2 |
jupytext: |
| 3 |
encoding: '// -*- coding: utf-8 -*-' |
| 4 |
formats: ipynb,java:light |
| 5 |
kernelspec: |
| 6 |
display_name: Java |
| 7 |
language: java |
| 8 |
name: java |
| 9 |
--- |
| 10 |
|
| 11 |
Let's define some class. |
| 12 |
|
| 13 |
```{code-cell} |
| 14 |
class A { |
| 15 |
public void hello() { |
| 16 |
System.out.println("Hello World"); |
| 17 |
} |
| 18 |
} |
| 19 |
``` |
| 20 |
|
| 21 |
And now we call its method. |
| 22 |
|
| 23 |
```{code-cell} |
| 24 |
new A().hello(); |
| 25 |
``` |
| 26 |
|
| 27 |
You can run it e.g. with `jshell` |
| 28 |
|
| 29 |
* from command line, as `jshell simple-helloworld.java` |
| 30 |
* from jshell's shell with `/open simple-helloworld.java` |