How java is platform independent?

Answer Posted / invisible

When you write the program for any programming language it
is called (source program), and it will have the extension
depending upon the language. For example, the C language
will have the extension ".c" and ".cpp" in C++.
When you compile the file or (source program), you will get
the ".exe" extension. This ".exe" file is executed by the
operating system in the C & C++ program.
If you are writing the program and compile it in one
operating system, you cannot take the same ".exe" file to
another operating system for extension. That means, this
program depends upon the operating system for its execution.

In Java, when you write the program, you will have
the ".java" file. And when it is compiled, you will get
the ".class" file. The ".class" file is executed by the
Java Virtual Machine (JVM). If you have the JVM, you can
execute the java program anywhere under operating system.
That means, that Java is PLATFORM INDEPENDENT.

Is This Answer Correct ?    191 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of arrays in java?

835


Name few java 8 annotations ?

799


What is var keyword ?

932


Why are the destructors for base class and derived class called in reverse order when the program exits

1949


When super keyword is used?

814


How would you use Bubble Sort to sort the number of elements?

826


What is the purpose of the finalize() method?

956


What is the difference between post and put?

779


Can list be final in java?

700


explain copyonwritearraylist and when do we use copyonwritearraylist?

753


Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.

1828


What is charat java?

746


How many types of flags are there?

745


What are thread safe functions?

729


How do you square a number?

890