Comparing Python and Java!

Posted by Derek Margheim on Nov 26, 2016

I've found Python 3.x to be the best language to learn programming. It is a dynamic programming language meaning that type-checking is done at run time instead of compile time. In Python, types don't need to be explicitly declared and conversions can be inferred. It's syntax is not only straight-forward and fairly concise, but also highly dynamic and weakly-typed. The keywords used by the compiler use plain English which makes abstract ideas easier to comprehend for the beginner.

This is in contrast to a language like Java which is a static programming language which is "strongly-typed." Types must be explicitly declared and conversions are also explicit in nature. Java is a great introductory language to static-programming while Python is a great introductory language to dynamic-programming. Below is a comparison of Python 3.x and Java.


        '''
        Some Python 3.x Code
        '''
        class Bicycle:
            def __init__(startCadence, startSpeed, startGear):
                self.gear = startGear
                self.cadence = startCadence
                self.spped = startSpeed
            
            def getCadence():
                return self.cadence
                    

        /**
         * Some Java Code
         */
        public class Bicycle {
        
            private int cadence;
            private int gear;
            private int speed;
            
        public Bicycle(int startCadence, int startSpeed, int startGear) {
            gear = startGear;
            cadence = startCadence;
            speed = startSpeed;
        }