Group: di-11-22 Subject Name: Engilsh
Download 249.74 Kb.
|
Toshkent named after Muhammad al-Khorazmi information Technology university Self study-3 Group: DI-11-22 Subject Name: Engilsh Did: Tuychiyev F Accepted ;Yaxshiyeva Z Overview
Java is considered both a compiled and interpreted language. It is because Java source code is first compiled to bytecode which is then interpreted by Java Virtual Machine. Java Virtual Machine interprets the bytecode and converts it to platform specific machine code. Hence, Java is also called a platform-independent programming language. Scope of article This article aims to: Explain the Java language, including its features and terminologies. Showcase examples and applications of Java programming language. The article does not compare Java with other programming languages. What is Java Programming? Java is a programming language that James Gosling developed at Sun Microsystems_Inc in the year 1995, which later on was taken into possession by the Oracle Corporation in 2009. We can call it a high-level (makes the development of programs easy and much more user-friendly) programming language which makes it very convenient for us to write, compile and debug Java programs. Java is a class-based object-oriented programming language that implements the principle of write once code anywhere. Since Java applications are compiled to byte-code, they can run on any JVM-supported machine. Java codes are very similar to C/C++, which makes them easier to understand. Let’s further look into this and read a few more facts about Java. Why Java Programming Language is Called JAVA? Java is the name of a beautiful island in Indonesia. It is also said that the first coffee was named right here after java coffee. The name was chosen by James Gosling during the daytime when he was enjoying a cup of coffee near his office. Java was initially called by the name: OAK. However, in the wake of the Oak Technologies, the team had officially decided to rename it. The options they considered were Silk, Revolutionary, Dynamic, DNA, and Jolt. Even though Silk was further selected, they decided to go along with Java as it was unique, and a lot of people preferred it. Now let's move on to why we use it. Why Use Java? As mentioned above, Java is a high-level language and should be studied if you want to know the basics of programming. Let us learn why there is a need to learn the language. 1) Object-Oriented 2) Portable 3) Simple 4) Secure 5) Robust 6) Platform Independent 7) Architecture neutral All of these features will be explained in detail below. JAVA Terminology Before moving further, there are some Java terms that we need to understand. So let's have a brief understanding of the Java terminology. Java Development Kit (JDK) As the name formally states, Java Development Kit is a full-time kit that has a compiler, Java Runtime Environment(JRE), Debuggers, and Java documents included in it. For further execution in java, we need to have JDK installed on our computers to further lead to the creation, compilation, and running of the java program. Here, as we use JDK, we need an environment to run the programs. We use JRE Java Runtime Environment, which provides the least requirements to execute the Java program. It provides the JVM, Core classes, and supporting files. Java Run-time Environment (JRE) JDK includes JRE, which, in turn, after installation, allows the Java program to run. But we still can't compile it. It has a browser, the applet supports, and a few plugins included in it. So, to run a java program on your respective computers, you need JRE. JRE is made up of multiple elements altogether, and they are: Java virtual machine (JVM) Java class libraries Java class loader When our software tends to execute a particular program, it requires some environment to run in. Usually, it's any operating system, for example, Unix, Linux, Microsoft Windows, or macOS. Here JRE acts as a translater and facilitator between the java program and the operating system. Java Virtual Machine (JVM) This generally is referred to as JVM and contains three phases that we have to follow. It is a very important part not only of JDK but also JRE as it is inbuilt in both of the places. When you run a program using the JRE and JDK, it also goes to the JVM as it is required to run the java program and interprets the program. The phases are as follows: Compile the Code: The Java Development Kit(JDK) provides us with the JAVAC compiler to get through this step. We basically require the JDK to convert our source code into a specific format (compiled code) that can be easily interpreted by the Java Runtime Environment(JRE). Run the Code: JVM runs the bytecode provided by the compiler. Since Java is a platform-independent language, the compiled code produced by the JAVAC compiler is converted to machine code using platform specific JVMs. Different platforms have different JVMs. JVMs convert the bytecode into platform specific machine code. Let’s now see how this bytecode is developed, making it easy for us to execute our programs. Bytecode in the Development Process The source code provided to the JAVAC compiler that is present in JDK gets compiled into a bytecode that the JVM can execute. It gets saved as a .class file by the compiler itself. We can also view this bytecode using a disassembler like javap. Garbage Collector Within Java, the programmers cannot delete the objects. Hence, to delete or recollect a memory, JVM has a Garbage Collector. These Garbage Collectors can recollect those objects which have not been referenced. Using this Java makes the life of a programmer very convenient by managing the memory. Despite this, programmers should be aware of what they are writing in their codes or if they are using objects that have already been used for longer. This is because this collector can’t restore the memory of objects that are referenced. Garbage collection here is an automatic process. Class Path Classpath is a particular file path where both the Java runtime and Java compiler look for .class files to appear. Although by default, the Java Development Kit provides us with quite a few libraries. Here you can also include an external set of libraries, but they should be added to the classpath beforehand. So we are done with the terminology now, so we can easily come and look at Java's features. Main Features Of Java This section will explain the features of the Java programming language. Let's have a look at all the main features of the Java programming language. Platform Independent First and foremost, the compiler converts the source code to its bytecode, and later on, JVM executes the bytecode generated by its compiler. Further, this bytecode can be run on any other platform, for example, Windows, Linux, or macOS. This means that we can compile a program on windows, then we can run it on Linux as well using the Linux's JVM. Every Operating System has different sets of JVM. These different JVMs generate different platform-specific machine code from the same bytecode. Hence, the output which will appear on all the Operating systems will be the same after the execution of our source code. And, so we call it a Platform Independent language. Object-Oriented Programming Language Object Oriented Programming organizes the software design and logic around classes, objects and data rather than procedures or functions. Object Oriented Programming uses real world concepts to implement the application code and keep data security and integrity at the centre of design. Let's understand this with the help of a real-life example: We all know that under the Class of Car, we have many options like Alto, WaganR, Santro, etc. In this manner: Each Car object has its specific Model, Colour, Engine power, Top Speed, Year of Manufacture, etc., which altogether are called the properties of the Car Class The functions performed by it, like Start, Stop, Move, etc., are the methods of this Car Class. No memory is allocated on the creation of a class, but we allocate memory when the object is created, which in our case is a new car object. The four basic principles in Object Oriented Programming: Inheritance Inheritance can be defined as an object acquiring all the behaviors and properties of a parent object. It makes our code reusable. Runtime polymorphism can be achieved using inheritance. So here, the voices of everyone, including the animals and the humans, are inherited by their parents; the dog barks like a dog, and the human speaks like his parents. Hence, we can see a real-life example of inheritance. Polymorphism When we perform a single task in multiple ways, it can be defined as polymorphism. In Java, programming language method overriding and method overloading is used to attain polymorphism. Overloading: when multiple methods in the same class have the same names but different parameters. Overriding: when the method name and the parameters are the same in the child class and the superclass, we call it overriding. Abstraction Abstraction is the concept of hiding internal implementation details and exposing only the required functionalities to the end users. In Java programming language, the interface and abstract class are used to attain abstraction. Example: We all visit the ATM machine for withdrawing cash and several other things as well, but we never get to know what happens internally inside the machine when we insert our ATM card for any operation. This can be seen as abstraction in real life. Encapsulation When data is bonded or wrapped together into one single unit, we can call it encapsulation. All the data and methods operating on the data are enclosed in the same unit. In the Java programming language, the java class is a major example of encapsulation. JavaBean is noticed to be fully encapsulated, and this is because all the data members are observed to be private here.  The way this capsule encloses all the contents of the medicine in a similar way when we wrap up data members and methods inside a class, we can term it to be encapsulation. Download 249.74 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling