answersLogoWhite

0

This is because Java runs it's code through a Virtual Machine which compiles it and runs it.

C will compile native on your machine and the code will be run directly, without the use of a virtual machine.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Why 2 files in java program?

There are programming languages in which the source file is read and interpreted directly, but those are usually slower than when the program is compiled, to an EXE, or as in Java, for a virtual machine.


Disadvantages of Java?

Advantage:1.) Java program are platform independent, it can run on any PC or any operation system.2.) It is dynamic, simple and robust.3.) It is purely OOPS language having all the OOPS concept.Disadvantage:1.) It takes more time to execute then " C language" as it runs first on JVM (Java Virtual Machine).2.) More memory consuming then other languages.


Why is Minecraft so slow?

probably because its an old program. Minecraft is slow on many computers because of the language it is written in- Java. Java is an interpreted language, so it often runs slower than other programs would. The advantage of using java, though, is that it runs on more computers because it is cross-platform. It isn't really slow. if u are having problems with speed its your computer


Why java 1.6 is better than java 1.4?

Java 1.6 includes all updates from Java 1.5. This adds the idea of generics to Java, which is worth using if you ever work with collections of data. Version 1.6 is basically a major update of 1.5 which includes many security fixes and a speed boost to code execution.


What is the difference between programming languages Java and C?

Java is pure object oriented programming language than c++, it uses the concepts of Classes, Objects, Inheritance, Polymorphism. And the execution of a program is non-linear.Java's motto (so to speak) is "write once run anywhere".When you compile a Java program, an intermediate bytecode is generated, which itself is interpreted by the Java Virtual Machine. This way you write a program once, and the virtual machine translates the bytecode into instructions a specific processor can understand. Execution of a Java program is by consequence a bit slow, because the intermediate bytecode has to be interpreted.Java uses a "Garbage Collector" which manages memory automatically so the programmer doesn't have to handle that.Variables in Java can be declared anywhere in a program. (Although it is recommended to declare/define them at the beginning of blocks).Reuse of code achieved by inheritance.By default members are private.During the execution of bytecode by JVM, it does not substitute the entire classes of package which are imported in the program. It just enters the package and executes the class and returns result in to the program. Due to this less memory is used by java program.CC uses concept of structures (not object oriented).In C we use the concept of pointers whereas there are no pointers used in JAVAIn C the programmer needs to manage memory manually. "malloc()" and "free()" are the fundamental memory allocation library calls.In C the declaration of variables should be on the beginning of the block.C supports go to statement, struct and union unlike JavaC is compiled to the machines "native language" so it's execution is much faster than Java's.No reuse in code and by default members are public.C programs will have a larger memory footprint than an equivalent program written in pure machine code, but the total memory use of a C program is much smaller than the a Java program because C does not require the loading of an execution interpreter like the JVM.The main differences between Java and C are speed, portability, and object-orientation.Difference between class and structure:In class,We can declare and define data members and member functions.But in Structure we can declare variables and functions.JAVA:Java was created for the purpose of making a language that could be implemented on many different types of computers (cell phone, mac, PC, linux, etc.) C on the other hand can only be run on a computer of the same type as the one that compiled the program.One of the costs of this portability in Java is speed. On numerous benchmarks Java still lags behind C in terms of speed, but that gap is narrowing.Java is also object-oriented, whereas C is not. Java allows a user to create classes that contain data and methods. C is not capable of doing that.


Why java applications take more memory than c sharp and also execute slower?

The timing and memory usage would seem to depend on what you're doing. In preparation for this answer, I ran several trials of a program in both Java and C#. The programs used the exact same algorithm to calculate all the prime numbers in [0, 100,000,000). In the six runs I did of each, the C# program took about 500ms longer and 16mb more RAM than the Java program. As I said, this was one example. Hopefully more people will post their own benchmarks and results to help determine which language is more suitable in which situations.


Why net is need when have java?

Java (from Sun) is a programming language that is interpreted in bytecode using a virtual interface, it sounds complicated and it is more complicated than simply using HTML to display a page, and it is also much slower.


Why c is preferred over Java for embedded system?

Embedded systems typically run on extremely limited hardware. Even the smallest implementation of Java (Micro Edition) can't compete with a small C implementation both in terms of memory footprint and execution speed.


How do you perform optimization on java program?

There is no single fast method to do any optimization - not in Java, not in other languages. If your program is slower than you expected, you must do some analysis to find out what makes it take long, and figure out better ways to do it. Often you can optimize in advance (while you write the program), simply by thinking about better ways to solve a problem. This may involve debugging techniques: step through the program to see what exactly it is doing - or insert commands to calculate elapsed time, to see whether a particular piece of code is fast enough.


What is meant by a thread in java programming language?

A thread and a process are same but a minor difference is there. Process executes a program completely without splitting whereas a thread splits a program into smaller tasks and then execute them separately.And then combine the final result. that is why a process is often called as Heavy weight and a thread is called as light weight.


What does java generate after compiling the java source code?

Java compiles to Java byte code; the native language of the Java virtual machine (JVM). The JVM is essentially just an interpreter for Java byte code. Each supported platform has its own JVM implementation so the same Java byte code can be executed upon any platform without further compilation, unlike C++ where source code must be compiled separately for each supported platform. However, interpretation results in slower execution speed and higher resource consumption than with C++ which compiles to native machine code.


Why and amp How is Java is Better For What if your Enterprise Application?

Java is defined by a specification and consists of a programming language, a compiler, core libraries and a runtime (Java virtual machine) The Java runtime allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine. The Java platform is usually associated with the Java virtual machine and the Java core libraries.