👉Why Learn Java?
At the moment, probably the most compelling reason to learn
Java—and probably the reason you bought this book—is that HotJava applets are
written in Java. Even if that were not the case, Java as a language has
significant advantages over other languages and other programming environments
that make it suitable for just about any programming task. This section describes
some of those advantages. Java Is Platform-Independent Platform independence is
one of the most significant advantages that Java has over other programming
languages, particularly for systems that need to work on many different
platforms.See More Videos About Java Programming:- Java is platform-independent at both the source and the binary
level. Platform-independence is a program’s capability of moving easily from
one computer system to another. At the source level, Java’s primitive data
types have consistent sizes across all development platforms. Java’s foundation
class libraries make it easy to write code that can be moved from platform to
platform without the need to rewrite it to work with that platform.
Platform-independence doesn’t stop at the source level, however. Java binary
files are also platform-independent and can run on multiple problems without
the need to recompile the source. How does this work? Java binary files are
actually in a form called bytecodes. Bytecodes are a set of instructions that
looks a lot like some machine codes, but that is not specific to any one
processor. Normally, when you compile a program written in C or in most other
languages, the compiler translates your program into machine codes or processor
instructions. Those instructions are specific to the processor your computer is
running—so, for example, if you compile your code on a Pentium system, the
resulting program will run only on other Pentium systems. If you want to use
the same program on another system, you have to go back to your original
source, get a compiler for that system, and recompile your code. Figure 1.2
shows the result of this system: multiple executable programs for multiple
systems. Things are different when you write code in Java. The Java development
environment has two parts: a Java compiler and a Java interpreter. The Java
compiler takes your Java program and instead of generating machine codes from
your source files, it generates bytecodes.
Post a Comment