From Python to Java

This site gives a quick overview of the differences and similarities between common programming idioms in Python and Java. Although it is intended for programmers who are making a transition from Python to Java, those who are making the move in the opposite direction can use it as well.

Python and Java programs both compile to machine-independent byte code, which can then be run on virtual machines (PVM and JVM, respectively) on host computers. Both languages support objects and classes, but Python, like C++, also allows the programmer to define free functions as well. Type checking in Java is done at compile time and in Python at run time. Python code can also be tried out interactively within an interpreter, whereas Java programs must flow through an edit/compile/execute cycle.

Program Structure and Execution

Data Types and Expressions

Simple Statements

Terminal Input and Output

Control Statements

Objects and Interfaces

Collections

Defining Classes

Inheritance

© Ken Lambert. All rights reserved.