27
What is Java? A simple guide for Beginners
Today, especially since a deadly epidemic has struck the world, the Internet and smartphones have become an integral part of our lives. We use our phones for almost every day. We used to shop at malls, line up at banks, and plan our trips at agencies. But now, we can do all these things in our homes using smartphones. All of this is made possible by a high-level programming language called Java.
James Gosling and Sun Microsystems invented the Java programming language in 1991. James wrote a slogan when creating this language: "Write once. "Run everywhere." They first named the language Oak, meaning oak, because there was an oak tree outside Gosling's office. The name was later changed to Green and then to Java Coffee, which was inspired by Indonesian coffee and was eventually abbreviated to Java in 1995.
What is Java used for?
Java is widely used in web consoles, graphical user interfaces, web and mobile applications, game development, embedded systems, and desktop applications. Apart from these, Java is also used for software development. This language is used in computers and mobile devices and even electronic devices such as televisions, air conditioners, washing machines, etc. Online registration forms, banking applications and online shopping are possible due to Java.
Java is based on C and C ++. The first Java compiler was developed by Sun Microsystems and was written in C using several libraries from C ++. Java files are converted to bit code format using a compiler run by a Java interpreter. Java code runs on the Java Virtual Machine (JVM).
There are three versions of Java. Developers can learn any of these versions based on the program they want to build.
Java Standard Edition - includes major libraries such as java.lang, java.util and more.
Java Enterprise Edition - Includes Java APIs such as JMS, EJB, JSPs / servlets and more.
Java Micro Edition - This version is used for Java programming on mobile phones, set-top boxes (converters or digital receivers), mobile phones, etc.
The most widely used version of Java is Java SE (Java Standard Edition). Most programs require this version.
Java Concepts
Basic concepts in Java are its object-oriented programming (OOPs) features. OOP facilitates software and application development as well as maintenance by providing the following concepts.
Object: An object is an element or creature that has a state and behavior. For example, a dog can be considered an object of color, race, name, and behaviors such as barking and eating.
Class: A class is a collection of several objects and you can use it to create as many objects as you like. Classes are used to organize code, just like how fruits, vegetables and تق are divided into different parts of a supermarket.
Constructor may seem like a method, but it is not. Its name is the same as the class name and does not return any values.
Inheritance is a concept in which a class acquires the characteristics and behaviors of the parent class.
Polymorphism is the process of doing a single task in different ways and allows programmers to use one word for different meanings in different contexts.
Abstraction Abstraction is used in Java to hide internal details and display essential details.
Encapsulation Packaging code and data together into one unit (such as a capsule) is known as encapsulation. The Java class is an example of Encapsulation.
Java features
Java has several qualities and features, including:
A simple syntax that is very easy to understand and learn
Java language is strong
Eliminates errors that occur in C and C ++ languages
Java consists of features such as garbage collection and exception management
As a portable language, it can run on any platform
Java is secure and can perform multiple tasks
Java is not as fast as C and C ++, but it performs better than any other language
Now that we have discussed the different features of Java, let's look at the different components.
The three main components that exist in the Java programming language are:
JVM: Java Virtual Machine or JVM is a platform-independent component that provides an environment for running Java applications. Thus, the JVM loads the code, validates the code, executes the code, and provides runtime.
JRE: The Java Runtime Environment, or JRE, creates an environment in which Java files can be run.
JDK: The Java Development Kit, or JDK Cloud, is a collection of JRE and software development environments used to develop Java applications and applets. The JDK includes a private JVM and several other resources to complete Java application development.
The four main concepts of object-oriented programming (OOP) are:
1- Abstraction
Abstraction means showing the relevant details and hiding all the internal details. In the following example, for admission to college, the relevant details required were name, address, parent name, and high school grades. Details such as sports, food, or favorite movies are not relevant.
C: \ Users \ MSA \ Downloads \ oops-command.png
2- Encapsulation
Capsule is like a capsule. The whole code and all the data are connected in one unit. All methods and variables are stored under a class name, and the same class object can use them.
3- Polymorphism
Polymorphism means that a task is done in different ways. A function is used for different tasks. In the following example, Method draw () can be used in different places to draw different shapes such as triangles, rectangles or circles.
C: \ Users \ MSA \ Downloads \ polymorphism.jpg
4- Inheritance
When one class inherits the properties of other classes, it is known as Inheritance. There is always a superclass and a subclass. The subclass inherits features from the superclass. In the following example, the animal is a superclass with the properties eat () and sleep (). Subgroups of reptiles, mammals, and humans inherit these traits.
C: \ Users \ MSA \ Downloads \ inheritence.jpg
How to learn Java?
Java is one of the most widely used programming languages, probably because it is versatile, reliable, and compatible. So, if you want to start programming professionally, it is better not to ignore Java:
Start by learning the basics of Java programming (variables, data types, conditional statements, arrays, loops, functions).
Learn advanced topics such as object-oriented programming, abstract class, Java interface, collections, abstract classes, exceptional handling, and packing classes.
Practice programming regularly.
Read new articles and documentation in Java to stay up to date.
Learn Java for free here (click)
Now the question arises: Do I need a Java certificate?
Some employers value certifications. Getting a certificate will help you grow your business and earn more money.
There are four types of certification levels:
- Oracle Certified Associate (OCA)
- Oracle Certified Professional (OCP)
- Oracle Certified Expert (OCE)
- Oracle Certified Master (OCM)
Choose the one that suits you. The main purpose of Oracle Java Certification exams is to test your knowledge and skills in future jobs in the Java industry.
Be sure to download: 6 of the best Java training PDF booklets
Hello World application in Java
C: \ Users \ MSA \ Downloads \ hello-world.png
Output:
C: \ Users \ MSA \ Downloads \ javac.jpg
Swap two numbers without using a temporary variable
C: \ Users \ MSA \ Downloads \ temp-variable.jpg
Output:
C: \ Users \ MSA \ Downloads \ javac-outout.jpg
How to start learning Java?
Conclusion
Almost everything we use in our daily lives is related to Java. The Java programming language is still one of the top technologies in the industry and its job demand is significantly high. We recommend that you learn Java as soon as possible and start your career in it.
27