Introduction to Java 1 / 1 What Is Java?
Total Page:16
File Type:pdf, Size:1020Kb
The origins of Java Java was originally designed for interactive television, but it was too advanced technology for the digital cable television industry at the time. James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of Sun Microsystems engineers was called Green Team. Firstly, James Gosling called the project ”Greentalk”, and the file extension was .gt. Later the project was called Oak as a symbol of strength. In 1995, Oak was renamed as Java because it was already a trademark by Oak Technologies. dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 1 / 1 What is Java? Java is object-oriented programming language and a platform. Object-Oriented Programming is a methodology/paradigm to design a program using classes and objects. Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and Application Programming Interface (API), it is called a platform. dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 2 / 1 Basic concepts of object-oriented programming Object - a unit that has its address and allocated space in memory. An object is an instance (element) of a class. Class - set of objects. It is a logical unit that does not take up memory. It is a pattern of objects. Inheritance - the objects of a given class have the properties of the parent class, which makes possible to reuse the code. Method - subroutine of the class (function). Works for a given class and child classes. Polymorphism - one task can be done in various ways. In Java, overloading and overwriting methods are used for this purpose. Abstraction - hiding internal details and showing functionality (abstract class, interface). Encapsulation - hiding certain fields of objects or methods of a class. dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 3 / 1 Compilation At compile time, the source file with the extension .java is compiled by the Java compiler (it does not interact with the operating system), which converts the Java code into bytecode. The bytecode can be executed by the Java Virtual Machine. dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 4 / 1 JVM JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn’t physically exist. It is a specification that provides a runtime environment in which Java bytecode can be executed. JVMs are available for many hardware and software platforms. JVM, JRE, and JDK are platform dependent because the configuration of each OS is different from each other. However, Java is platform independent. The JVM performs the following main tasks: Loads code Verifies code Executes code Provides runtime environment dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 5 / 1 JRE, JDK JRE (Java Runtime Environment) is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. It is the implementation of JVM. It physically exists. It contains a set of libraries and other files that JVM uses at runtime. JDK (Java Development Kit) is a software development environment which is used to develop Java applications and applets. It physically exists. It contains JRE and development tools. dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 6 / 1 JVM, JRE, JDK dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 7 / 1 The first program class Hellof public static void main(String[] args)f System.out.println("Hello Java"); g g dr Anna Łazińska, WMiI UŁ Introduction to Java https://www.javatpoint.com 8 / 1.