- How is the JVM and Java’s WORA different from other high level languages?
- 5 Answers 5
- How is java different from other programming languages
- Comparison of Java with other programming languages
- What’s the difference between JavaScript and Java?
- How is Java different than other programming languages?
- A bit about Java
- Why Java is popular?
- How java is platform indepentent?
How is the JVM and Java’s WORA different from other high level languages?
In the Java world, we often talk about the JVM, and when Java was new it had the supposedly killer feature of «Write Once, Run Anywhere.» From the way people talk and write, this seems different from the way that Python, for example, works. Yet I’ve not been aware of any way that Python code that I’ve written would work differently on another machine. (Though I haven’t written that much Python.) So what am I missing? How is the JVM different from a Python interpreter? Is there a way that Python lacks Java’s platform independence? Or is this just a cultural difference?
The primary difference is the strictness of the JVM specification. It is simply very well defined how it must (not should) behave.
5 Answers 5
Java does a very good job on isolating you from the underlying OS and gives you the same exact tools on most platforms it works on to talk to things in the underlying OS.
Python on the other hand does not do as good of a job in isolating you from the underlying OS, It does not have a standard way of handling between process communications (look at the differences in the sys module and os module between a windows and *nix implementation of Python for example.)
I have written code in python that would only work on a *NIX box or Windows box using just Python available API calls, where in Java it would be very difficult to write code that was just Java API that would not work the same on both a Windows box or *NIX box
It’s not at all difficult to write Java code that works only on Windows; just hard-code a Windows file path like «C:\MyApp\data»
@kevincline Hardcoded paths are a bad practice on any operating system. But Java doesn’t require you to do this, because it offers OS-independent methods to retrieve common directories like the user directory or the install path of the current program.
Topically and just from a language runtime, there is little difference. The JVM in particular is designed not just as an interpreter but also a runtime compiler, code inference, an instrumental virtualization layer that can have dynamic hooks applied, various GC semantics and the ability to describe virtualization ergonomics, to name a few. Python can run in a JVM? Can Java run in a Python interpreter?
Most interpreters are runtime language/token interpreters, JVMs (and others) as you know interpret/compile/run intermediate code. IBM for instance has been doing this for decades outside of Java, it is nothing new. Even VB ran in intermediate code for some time I believe?
The WORA is mostly passé now as many interpreted languages run just about anywhere unchanged.
How is java different from other programming languages
Java first converts the code into machine language so that it can be understood by it and because of this Java code runs faster than Ruby’s code. But Python programs are generally expected to run slower than Java programs.
Comparison of Java with other programming languages
Java is one of the most popular and widely used programming language and platform. A platform is an environment that helps to develop and run programs written in any programming language.
Java is fast, reliable and secure. From desktop to web applications, scientific supercomputers to gaming consoles, cell phones to the Internet, Java is used in every nook and corner.
Here we are comparing 3 other languages (Python, C++, Ruby and C) with Java.
- Python is a high-level language. It fully supports object-oriented programming. Python is not a pure object-oriented language.
- Python is an interpreted language whereas Java is not an interpreted language, it is a compiled language.
- Python is a scripting language whereas JAVA is a low-level implementation language.
- Python is easy to use whereas JAVA is not as simple as Python. Programmers prefer to use python instead of Java because python contains less line of code whereas Java is just opposite to it.
- Python programs are much shorter than JAVA programs.
- Python is widely used in companies for building projects as its programs are shorter whereas JAVA is rarely used in companies for projects because it is difficult to use.
- Python supports dynamic typing which is very useful for the programmers because they need to write less code because of which their time is saved and which is user-friendly as well as programmer-friendly. But in the case of JAVA, developers are required to define the type of each variable before using it which consumes the programmer’s lots of time.
- Many large organizations like Google, Yahoo, NASA, etc. are making use of Python. But Python programs are generally expected to run slower than Java programs.
- Java has much better library support for some use cases than Python which is the biggest advantage of JAVA.
- Python is very much slower than Java.
- Java was basically derived from C++.
- C++ is both procedural and object-oriented programming language whereas Java is a pure object-oriented language.
- Both the languages have different objectives which means it has many differences too.
- The main objective of C++ is to design a system of programming.
- Java doesn’t support operator overloading but C++ does support it.
- C++ also extends the C programming language whereas Java is basically created to support network computing.
- Java doesn’t support structures and unions where C++ does support it.
- Java is much slower than C++ in terms of execution.
- C++ libraries are simple and also they are robust. It also provides container and associative arrays. But Java contains a powerful cross-platform library.
- In Java, there is an automatic garbage collection whereas this is not the case in C++. In C++ all objects are destroyed manually with the help of the code.
- C++ supports pointers which are variables which store addresses of other variables. But Java does not have any kind of variable which stores addresses of other variables.
- C++ executes its programs very fast compared to Java.
- Ruby and Java are object-oriented languages and also they are strongly typed.
- Java is statically typed whereas Ruby is dynamically typed.
- Both languages have a different method for executing the code. Java first converts the code into machine language so that it can be understood by it and because of this Java code runs faster than Ruby’s code.
- Both Java and Ruby provide inheritance and they both have public, private, and protected methods.
The functions in Ruby take less numb code lines than Java because of which Ruby is preferred first by the developers and programmers.
- C is very much like C++(which was used to derive Java). In fact, C++ is an updated form of C.
- C is a structure or procedure-oriented language whereas Java is an object-oriented programming language.
- Execution time for programs written in C is very less when compared to Java.
- C supports pointers whereas Java does not support variables for storing addresses of other variables.
- C cannot handle exceptions in its program whereas Java is very good at handling exceptions.
What are the main differences between the Java platform, The main differences between the Java platform and other platforms are: Java is platform independent because of this characteristic we can write Java code in one platform and can be read/run in/on any other platform i.e WORA (Write Once Read Anywhere). Other languages lack this capability. …
What’s the difference between JavaScript and Java?
How is Java different than other programming languages?
Hello Developers, In this article, I have explained many things regarding Java and I have also explained some important features of Java which played important role for making Java different and better than other programming languages. Now, without further ado, let’s dive right into it.
A bit about Java
Java is a programming language, it is a technology which is used for software development. Java is an Object Oriented programming language which is developed by James Gosling and it was published by Sun Microsystems in 1995.
There are many programming languages which are also used for software dovelopment. Now, you might be thinking that why java is getting popularity compared to other programming languages?
Why Java is popular?
As we know java is high level, object-oriented programming language. One of the most important feature of java is that, it is platform indepentent. Java gets more popularity because of this feature.
Ok Guys, One question arise, what is a platform? After learning what is platform we will discuss about platform indepentent feature of Java.
Platform: An environment in which a program can be executed is known as a Platform. Platform can be a hardware or a software or may be both.
- Hardware platform means any physical machine. Which is used for executing the code.
- Software is a set of instructions which is developed for executing a particular task which is installed in physical machine.
Ok Guys now we try to understant about platform indepentent.
Platform independent means that java code does not depend on any machine. Bascially here machine word is used for Operating System.
Write your java code on one machine and you can excute the same code on other machine as well without making any changes in your code.
For Example: If you have written Java code on one machine, suppose Windows, than it can also be executed on Linux, Unix, Macintosh platform without making any changes. But this is not the case with langauges like C and C++, these languages are platform dependent. It is not required to make any changes in code if you are executing your same Java code on different operating system. That’s why we can say java code is write once and run anywhere.
How java is platform indepentent?
Most of the programming languages are platform dependent. These languages code can’t be executed on multiple machines without any change in code. If you want to run the code on other machine, you must perform change in your code.
For Example, you can’t run the code of C and C++ on Unix if the code was created on windows because both are different operating system. C ,C++ code is machine dependent while Java is platform indepentent because of JVM.
JVM stands for Java Virtual Machine which is platform dependent. Every operating system has its own JVM which has its own implementation of Java as per operating system. JVM is vital part of java, it takes byte code as an input and converts it into machine code.
The byte code is generated by the compiler (JavaC). Java compiler compiles the java source code and converts it into byte code after that code is handed over to JVM.