Sunday, November 25, 2018

Java 101

A complete introduction for beginners to the Java platform

So, do you want to program in Java? This is great and you have come to the right place. The Java 101 series provides a self-guided introduction to Java programming, starting with the basics and covering all the main concepts you need to know to become a productive Java developer. This series is technical, with many code examples to help you understand the concepts as we go. I guess you already have some experience in programming, but not in Java.

This inaugural article presents the Java platform and explains the difference between its three editions: Java SE, Java EE and Java ME. You will also learn about the role of the Java virtual machine (JVM) in the implementation of Java applications. I'll help you set up a Java Development Kit (JDK) on your system so you can develop and run Java programs, and start with the architecture of a typical Java application. Finally, you will learn how to compile and run a simple Java application.

What is Java?

You can think of Java as a general-purpose object-oriented language that looks a lot like C and C ++, but which is easier to use and allows you to create more robust programs. Unfortunately, this definition does not offer much information about Java. A more detailed definition of Sun Microsystems is as relevant today as it was in 2000:
Java is a simple computer language, object oriented, intelligent in network, interpreted, robust, secure, with neutral architecture, portable, high performance, multithread and dynamic.


We will consider each of these definitions separately:

Java is a simple language. Java was initially modeled after C and C ++, minus some potentially confusing resources. Pointers, multiple implementation inheritance and operator overload are some C / C ++ resources that are not part of Java. A non-mandatory feature in C / C ++, but essential for Java, is a garbage collection feature that automatically retrieves objects and arrays.

Java is an object-oriented language. The object-oriented Java approach allows developers to work on Java adaptation to solve a problem instead of forcing us to manipulate the problem to meet language restrictions. This is different from a structured language like C. For example, while Java allows you to focus on objects in the savings account, C requires that you think separately about the state of the savings account (such balance) and behaviors ( as deposit and drawing).

Java is a language with network knowledge. The extensive Java network library makes it easy to manage TCP / IP network protocols, such as HTTP (Hypertext Transfer Protocol) and FTP (File Transfer Protocol) and simplifies the task of making network connections. In addition, Java programs can access objects through a TCP / IP network, through resource locations (URLs), with the same ease with which they are accessed from the local file system.

Java is an interpreted language. At run time, a Java program runs indirectly on the underlying platform (such as Windows or Linux) through a virtual machine (which is a software representation of a hypothetical platform) and the associated execution environment. The virtual machine translates the bytecodes of the Java program (instructions and associated data) for specific instructions of the platform by means of interpretation. Interpretation is the act of discovering what a bytecode instruction means and then choosing equivalent "canned" platform-specific instructions to execute. The virtual machine then executes these platform-specific instructions.

The interpretation facilitates the debugging of defective Java programs, because there is more information at compile time available at runtime. The interpretation also makes it possible to delay the connection stage between the parts of a Java program until the execution time, which accelerates the development.

Java is a robust language. Java programs must be trusted because they are used in personal and mission-critical applications, from Blu-ray players to air navigation systems or air control. The language resources that help make Java robust include declarations, duplicate type checking at compile time and runtime (to avoid version incompatibility issues), true arrays with automatic boundary checking and pointer omission. 

Another aspect of Java's robustness is that loops must be controlled by Boolean expressions instead of integer expressions, where 0 is false and a non-zero value is true. For example, Java does not allow a loop in style C, such as while (x) x ++; because the loop cannot end where it is expected. Instead, you must explicitly provide a Boolean expression, such as while (x! = 10) x ++; (which means that the loop will run until x equals 10).

Java is a safe language. Java programs are used in network / distributed environments. Because Java programs can migrate and run across multiple platforms on a network, it is important to protect these platforms against malicious code that can spread viruses, steal credit card information, or execute other malicious acts. The characteristics of the Java language that support robustness (such as the omission of pointers) work with security features, such as the Java sandbox security model and public-key cryptography. Together, these resources prevent viruses and other dangerous codes from wreaking havoc on an unmanned platform.
In theory, Java is safe. In practice, several security vulnerabilities have been detected and explored. As a result, Sun Microsystems and Oracle now continue to release security updates.

Interested in learning Java? Join now:” java training in chennai “

Java is a neutral language in architecture. Networks connect platforms with different architectures based on various microprocessors and operating systems. You can not expect Java to generate platform specific instructions and have those instructions "understood" by all types of platforms that are part of a network. Instead, Java generates platform-independent byte code instructions that are easy to interpret for each platform (through its JVM implementation).

Java is a portable language. The neutrality of architecture contributes to portability. However, there is more to Java portability than platform-independent byte code instructions. Consider that the sizes of integer types should not vary. For example, the 32-bit integer type should always be signed and occupy 32 bits, regardless of where the 32-bit integer is processed (for example, a platform with 16-bit registers, a platform with 32-bit registers or a table platform with 64-bit registers). Java libraries also contribute to portability. When necessary, they provide types that connect Java code to platform-specific resources in the most portable manner possible.

Interested in learning Java? Join now:” java training in bangalore

Java is a high performance language. The interpretation produces a level of performance that is generally more than adequate. For high-performance application scenarios, Java uses just-in-time compilation, which analyzes interpreted bytecode instruction sequences and compiles frequently interpreted instruction sequences for platform-specific instructions. Subsequent attempts to interpret these sequences of bytecode instructions result in the execution of equivalent platform-specific instructions, resulting in increased performance.

Java is a multiprocess language. To improve the performance of programs that must perform several tasks at the same time, Java supports the concept of chained execution. For example, a program that manages a graphical user interface (GUI) while waiting for the input of a network connection uses another thread to execute the wait instead of using the standard GUI thread for the two tasks. This keeps the GUI responsive. The Java synchronization primitives allow the threads to securely communicate data with each other without corrupting the data. (See programming chained in Java, discussed elsewhere in the Java 101 series).

Java is a dynamic language. Because interconnections between program code and libraries occur dynamically at runtime, it is not necessary to explicitly link them. As a result, when a program or one of its libraries evolves (for example, for error correction or performance improvement), a developer only has to distribute the updated program or library. Although dynamic behavior produces less code to distribute when a version change occurs, this distribution policy can also lead to version conflicts. For example, a developer removes a class type from a library or renames it. When a company distributes the updated library, existing programs that depend on the type of class will fail. To greatly reduce this problem, Java supports a type of interface, which is like a contract between two parties.




No comments:

Post a Comment

From Java 8 to Java 11

Switching from Java 8 to Java 11 is more complicated than most updates. Here are some of my notes on the process. Modules Java 9 i...