Chapter 1: Introduction

Python vs. Java - Main method

face Josiah Wang

Let’s put the Java and Python codes side-by-side to compare them (You can click on the image for a larger version)

Firstly, there is no need to define a class or a main method in Python.

You can also name the Python script to whatever you want (ending with .py).

When you run a Python script, everything that’s not defined in a function or class will be executed.

Simple guessing game - Java vs Python