The difference between Python and Java in run a program
- In Python, we can run a single line of code at the shell, or we can run an entire module. A Python module is simply the code that exists in a single file. When we run a module, the code is executed from top to bottom.
- In Java, we don't have the concept of a module. Instead, everything is organized around classes. When we execute a program in Java, we actually execute a class. Of course, a class may have multiple methods in it, so which one is executed? There is a special method called main that any class may define. If we run that class, the main method is executed.
class Hello {
public static void main(String[] args) {
// The method body will go here.
}
}
Question mark:public static void main(String[] args) the meaning of the other parts of the main method.
Question mark: What is module and what is shell

浙公网安备 33010602011771号