Java Tutorial for Python Programmers

Java Files and Classes

Unlike Python, Java can't have a file with just a single print statement. Instead, each file must contain a class with the same name as the file. For example, the following could be the code inside CodeToRun.java:

public class CodeToRun {
    
    //code inside the class. (This is a comment.)
    
}
        

Java class names should always be given in PascalCase, just like in Python. Variable names, however, should be in camelCase instead of snake_case. The difference between camelCase and PascalCase is only that the first letter is always lower case in camelCase.

Use What You Learned

Create a new file, Monkey.java with the class declaration inside.