Uploaded by Brian Harvey Tagustos

JAVA VS PYTHON

advertisement
A COMPARISON BETWEEN TWO LEADING
Programming Languages
LET'S COMPARE TWO OF THE MOST POPULAR
PROGRAMMING LANGUAGES RIGHT NOW.
JAVA
PYTHON
Differences
It is mostly regarded as a compiled language,
but some sources consider it as both
compiled and interpreted language.
It is an interpreted language.
It is a statically-typed language, performing
type checking at compile time, thus faster than
Python.
It is a dynamically-typed language,
performing type checking at runtime, thus,
slower than Java.
It is more portable. Its programs can run on
any computer or mobile device which is able to
run the Java Virtual Machine (JVM).
It is portable but less portable than Java. Its
programs need an interpreter installed on the
target machine to translate Python code.
It offers stable connectivity when it comes to
database support.
It offers weak connectivity when it comes to
database support.
It is more secured than Python due to its
advanced authentication and access control
functionalities for web application security.
It is less secured than Java. Python also has
advanced security measures, but falls short
compared to Java.
Supports AI and Machine learning with
limitation.
Actively supports AI and machine learning.
Multiple inheritances is not
supported/partially done through interfaces.
It offers both single and multiple
inheritances.
It is best for Desktop GUI apps, Embed
Systems, Web application services, etc.
Python is excellent for scientific & numeric
computing, Machine learning apps, more.
It has a complex learning curve. Its syntax is
difficult to read and remember.
It is easy to learn and use. Its syntax is
almost similar to human language.
Codes are verbose, using more line of code
(takes 10 lines of code to read from a file).
Codes are concise, using less line of code
(takes 10 lines of code to read from a file).
Ignores whitespaces and uses curly braces
to define the beginning and end of each
function and class definition.
Whitespaces are part of syntax and uses
indentation to separate code into code blocks.
Statements in Java always end with a
semicolon (;). It is possible for a statement to
run over more than one line, or to have
multiple statements on a single line.
Python is line-oriented: statements end at the
end of a line unless the line break is explicitly
escaped with \. There is no way to put more
than one statement on a single line.
Java conditional statements have the form
ifif(condition)
condition and an optional else
else part has
else (no colon). There is no elif
the form else
elif formelse
if is used directly.
else
Python conditional statements have the form
if
condition : and an optional else part has
if condition
else The form elif
the form else:.
elif condition
condition : is
allowed as an alternative to an else
else:
immediately followed by an if.
if.
The scope of a Java conditional or looping
statement is normally just the next statement.
Indentation is ignored by the compiler.
The scope of a Python conditional or looping
statement is denoted by indentation.
A Java function definition always occurs in the
context of some class. It has the form
type function-name(formal-parameterlist)
{
body
}
A Python function definition has the form
def function-name(formaldef
parameter-list):
body
BRIAN HARVEY M. TAGUSTOS
BSCE 2-1
202101453
CENG 21A
A COMPARISON BETWEEN TWO LEADING
Programming Languages
LET'S COMPARE TWO OF THE MOST POPULAR
PROGRAMMING LANGUAGES RIGHT NOW.
JAVA
PYTHON
Similarities
Python and Java are both members of the Algol family, using syntax and concepts that originated with
the AlgolLanguage (a portable language for scientific computations often credited with introducing many
of the common syntax and structured programming conventions found in most modern programming
languages.)
Python and Java are both object-oriented programming languages, using objects to define fields
pertaining to the object and operations that may access or manipulate its state.
Python and Java both have strong cross-platform support and extensive standard libraries.
Python and Java are both open-source, the source code is open for any user to make changes and
customize to their needs. Because of this, there’s a huge community behind both programming
languages.
Python and Java both compile to bytecode.
Python and Java are both case sensitive. (Y is not the same as y).
In Python and Java, it is common to have one class definition per file. Both use class reserved to
create a class program
Python and Java both have variables and methods in their classes.
Python and Java both use .(dot) operator to access the methods.
Python and Java both have garbage collection for memory management objects.
Python and Java both support multiple paradigms.
Python and Java are both among the most popular/used programming languages (4th and 5th
respectively) in the world (Stack Overflow, 2020).
BRIAN HARVEY M. TAGUSTOS
BSCE 2-1
202101453
CENG 21A
Download