CSC300 / CSC402: Main [1/11] |
Python | Java | ||||
---|---|---|---|---|---|
|
|
Every java program requires a main
function. It must
be declared exactly as on the third line above.
Every java function resides in a class, in this case Hello
.
Every java class resides in a package, in this case algs11
.
Java includes visibility annotations, such as public
and private
. In python, everything is
public
.
Java functions are written using the keyword
static
. (More later.)
Java functions must include types for arguments and results, in
this case String[]
and void
.
Both java and python code is compiled before it is run.
The python interpreter performs both these steps, interactively.
For java, we will be using IntelliJ IDEA, which continuously compiles your code.
If the code successfully compiles (no red marks), then
you can run it by pressing the play
button.