Java - Why can you call a method before it has been defined? :     public class MainClass {

        public static void main(String[] args) {

            anotherTest();
            test();

        }

        public static void test() {
            System.out.println("Printed from the test method.");
        }

        public static void anotherTest() {
            System.out.println("Printed from the anotherTest method.");
        }
    }
Hello,

Sorry if this is a basic question but this has been puzzling me for quite some time. 

I would like to know why you can call a method before it has been defined like the code above. The code above shows two methods at the bottom of the page but I am calling them in the main method before they have been loaded. If I were to do something similar in Python I would get an error.

Thanks,
Test.