In today's era, the internet and smartphones have become an integral part of our lives. We use our phones for almost all of our day-to-day tasks. Earlier, we used to shop at malls, queue up in front of banks and make our travel bookings at travel agencies.
But now, we can do all this in the comfort of our homes using smartphones. All of this is possible because of a high-level programming language called Java. Hi guys, welcome to this video that will tell you everything you need to know about the class-based, object-oriented programming language Java.
Java is an object-oriented programming language that is used in a distributed environment on the internet. It is a high-level language that is easy to read and understand. Java is popularly used in console, graphical user interface, web and mobile applications, game development and also to make embedded systems. Apart from these, Java is also used to develop software for devices.
It is used not only in computers and mobiles, but even in electronic devices like televisions, washing machines, air conditioners, and so on. Online forms, banking, and shopping are possible because of Java. Java is a computer-based programming language invented by James Gosling and Sun Microsystems in 1991. He had a single motor while creating the language.
It was write once, run anywhere. This meant that the code would have to be written only once, but it could be used anywhere. They named this language Oak because of the oak tree outside Gosling's office.
Later, it was named to Green, then to Java Coffee, which was named after the coffee from Indonesia, and finally to Java in 1995. There are three editions of Java. Each programmer can learn any of these editions based on the application they want to make. Firstly, we have Java Standard Edition.
This edition contains core libraries like java.lang, java.util, etc. Secondly, we have Java Enterprise Edition. This edition has APIs like JMS, EJB, JSP, Servlets, etc.
And lastly, we have Java Micro Edition, which is used to program Java in cell phones, setup boxes, handhelds, and so on. Java is an object-oriented programming language based on C and C++. However, it is improved and simplified to solve the errors in programming.
Java files are converted to bitcode format using a compiler and then executed by the Java interpreter. The whole Java code is run on the Java Virtual Machine which provides a runtime environment. Now the main concepts in Java are its methods and classes. A method is a block of code that performs a task only when it is called. Consider this example.
While watching TV, you use the TV remote to change channels. Each button on the remote performs a different task. Methods in Java are the same.
We can have methods to add two numbers or email a person or to convert kilometers to meters. A group of methods make a class. Classes are used to organize code just like how fruits, vegetables and clinical products are divided into different sections in a supermarket.
There are a lot of features in Java. Let's start by looking at them one by one. It has a simple syntax and is very easy to understand and learn.
Java language is robust. It eliminates errors that occur in the C and C++ languages. Java also has features like garbage collectors and exception handling. This makes Java very unique. The most popular feature of Java is that it is platform independent.
Here, compilation happens in bytecode and because of this, Java can run on any machine. It is a very secure language as it contains no virus. Java has a feature of multi-threading. The feature of multi-threading helps Java do multitasking. Java is a portable language as it can run on any platform, and data type sizes are set permanently.
So, Java program has a fixed size of the code. The last of all, Java is not as fast as C and C++, but provides higher performance than any other language. Now, let's see OOPS concepts in Java.
Java has four concepts. Abstraction, Encapsulation, Inheritance and Polymorphism In Java, we use objects and classes related to the real world that makes the code easier to make and understand. Abstraction means showing the relevant information that is needed for a task.
Encapsulation makes the Java code secure. Data is stored within the classes, and it is not easy to access the data. The next feature is Inheritance.
As the name suggests, The attributes and characteristics of one class can be inherited by another class. Because of this, coders take less time to create the code. Lastly, we have polymorphism, which means using the same method for different tasks.
In Java, we can use the same object or variable in two different places where their tasks will differ. This brings us to the end of this video. Thank you for watching. Keep learning and stay tuned for more from Simply Learn.