Features of Java:
Simple, Small and Object Oriented
offers several benefits over other programming languages. It is small and
simple, and it is object oriented. It may be treated as both a compiled and
interpreted language. The executable generated by the Java compiler run on any
platform that provides a JVM. The Java platform itself is robust and secure.
Like many other languages, it supports multi threading, albeit in a much simpler
form. And lastly, like a few other languages, it is dynamic in nature. We will
now look at each of these features in more detail.
stated previously, the main motive behind creating Java was to develop a
language for embedded systems programming. The executable code generated by
Java is very small; typically, a Hello World application translates into just a
few bytes. Compare this with similar code generated by a C++ compiler, which is
easily a few kilobytes in size and additionally requires lot of memory for its runtime.
The runtime environment required to run Java compiled code typically takes less
than 1MB of memory space. Again, contrast this with the runtime required to run
a C++ application, which involves not only hundreds of megabytes of code
embedded in MFC (Microsoft Foundation Classes) or OWL (Borland’s Object
Windowing Library) but also requires a sophisticated operating system and
hardware to deploy it. Although this was true for both stand-alone and
GUI-based applications during the previous decade, Microsoft’s current .NET
platform provides architecture similar to Java and its executable, and run time
environment requirements are comparable to those of Java’s.
object oriented, Java is simple to learn. It has often been said that people
who never learned procedure-oriented languages such as C and Pascal will always
leap-frog those who have when it comes to learning an object-oriented language.
Those who have learned procedural-oriented languages typically find the
migration to object-oriented languages difficult because it may require some
undoing of what they have learned previously. Java is simple enough to be
introduced as a first programming language in any computer science curriculum.
next important feature of Java is that it is object oriented. C++, which
originated from C, allows global variable declarations, which means that the
variables can be declared outside the scope of any object—to be more precise,
outside of any class definition. This violates the rules of encapsulation—one
of the important features of an object-oriented language. Java does not allow
global declarations. Similarly, in Java, there are no structures and unions
like in C and C++ that break the rules of object orientation by making all
their members public by default. The absence of these features in the Java
language has made it a better object-oriented language.
Java, the entire code consists of only fully encapsulated classes. We’re
probably wondering about the primitive data types. Are these, too, represented
as objects in Java? To maintain efficiency, Java declares primitive data types
as non-objects; however, it also provides wrapper classes for these primitive
data types should we prefer to use objects holding the primitive data type