Java is one of the popular languages in the open source world. Here we are listing ten things which a java developer should know. These can be considered as features of java and highlights of why Java is so popular.
Java is easy to learn and use effectively. If we know the basic concept of C, learning of java will be easier. Awareness of C++ programming also reduces java learning effort, because it inherits many of the C++ features and C/C++ syntax.
Java applets provide some security mechanism. Java has not any harmful action about local resources. Also it eliminates the pointers. That is java applets prevent virus attacks.
For example some time we are trying to download some codes it contains some virus, Trojan horse or other harmful code. These malicious codes some time leads our system to damage state because it allows unauthorized access to system resources. Eg:- A malicious code might gather private information, such as credit card numbers, bank account balances, and passwords, by searching the contents of your computer’s local file system. By the usage of java applets java achieved some protection by confining an applet to the Java execution environment and not allowing it access to other parts of the computer. Java applets prevent whole malicious code attacks. The ability to download applets with confidence that no harm will be done and that no security will be breached is considered by many to be the single most innovative aspect of Java.
Nowadays we are connected to the different types of computers and operating system. In this situation in this situation portability is the major issue in the aspect of the internet. Java resolves this issue. Because java is platform independent, it works anywhere. Java uses byte code and class file concept. That is java helps our source code converted to executable program by using byte code. Byte code generates intermediate code after compilation. That is it produces one class file after compilation.
If a Java program were to be run on virtually any computer connected to the Internet, there needed to be some way to enable that program to execute on different systems. For example, in the case of an applet, the same applet must be able to be downloaded and executed by the wide variety of CPUs, operating systems, and browsers connected to the Internet. It is not practical to have different versions of the applet for different computers. The same code must work on all computers. Therefore, some means of generating portable executable code was needed.
The object model in Java is simple and easy to extend, while primitive types, such as integers, are kept as high-performance no objects. Three main features of object oriented programming are given below.
The program must execute reliably in a variety of systems because of the multi platform environment of the Web places extraordinary demands on a program. Java will be use a efficient garbage collection method and also it is a intelligent exception handler. Thus, the ability to create robust programs was given a high priority in the design of Java. To gain reliability, Java restricts you in a few key areas to force you to find your mistakes early in program development. At the same time, Java frees you from having to worry about many of the most common causes of programming errors. Because Java is a strictly typed language, it checks your code at compile time. However, it also checks your code at run time. Many hard-to-track-down bugs that often turn up in hard-to-reproduce run-time situations are simply impossible to create in Java. Knowing that what you have written will behave in a predictable way under diverse conditions is a key feature of Java.
To better understand how Java is robust, consider two of the main reasons for program failure: memory management mistakes and mishandled exceptional conditions (that is, run-time errors). Memory management can be a difficult, tedious task in traditional programming environments. For example, in C/C++, the programmer must manually allocate and free all dynamic memory. This sometimes leads to problems, because programmers will either forget to free memory that has been previously allocated or, worse, try to free some memory that another part of their code is still using. Java virtually eliminates these problems by managing memory allocation and deallocation for you.
(In fact, deallocation is completely automatic, because Java provides garbage collection for unused objects.) Exceptional conditions in traditional environments often arise in situations such as division by zero or “file not found,” and they must be managed with clumsy and hard-to-read constructs. Java helps in this area by providing object-oriented exception handling. In a well-written Java program, all run-time errors can—and should—be managed by your program.
Multi threaded means,
Java was designed to meet the real-world requirement of creating interactive, networked programs. To accomplish this, Java supports multithreaded programming, which allows you to write programs that do many things simultaneously. The Java run-time system comes with an elegant yet sophisticated solution for multiprocess synchronization that enables you to construct smoothly running interactive systems. Java’s easy-to-use approach to multithreading allows you to think about the specific behavior of your program, not the multitasking subsystem.
Architecture- neutral means write once, run anywhere, anytime forever. A central issue for the Java designers was that of code longevity and portability. One of the main problems facing programmers is that no guarantee exists that if you write a program today, it will run tomorrow—even on the same machine. Operating system upgrades, program malfunction. The Java designers made several hard decisions in the Java language and the Java Virtual Machine in an attempt to alter this situation. Their goal was “write once; run anywhere, anytime, forever.” To a great extent, this goal was accomplished.
Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java byte code. This code can be executed on any system that implements the Java Virtual Machine. A java virtual machine is a set of computer software programs and data structure that use a virtual machine model for the execution of other programs and scripts. Java virtual machine operates on java byte code which is normally generated from java source code. Byte code is a highly optimized set of instructions designed to be executed by JVM. Most previous attempts at cross-platform solutions have done so at the expense of performance. As explained earlier, the Java byte code was carefully designed so that it would be easy to translate directly into native machine code for very high performance by using a just-in-time compiler. Java run-time systems that provide this feature lose none of the benefits of the platform-independent code.
Java is designed for the distributed environment of the Internet because it handles TCP/IP protocols. We can use this any areas. In fact, accessing a resource using a URL is not much different from accessing a file. Java also supports Remote Method Invocation (RMI). This feature enables a program to invoke methods across a network.
Java supports run time memory allocation and binding mechanism. Java programs carry with them substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run time. This makes it possible to dynamically link code in a safe and expedient manner. This is crucial to the robustness of the Java environment, in which small fragments of byte code may be dynamically updated on a running system.
Hope the above ten things about java provided a good insight to the features of Java and will help you to improve your knowledge as a Java developer.