Java Introduction

Java will be introduced and explained in this post in the hopes that it will satisfy our educational needs.

What is Java?

The Java programming language is a powerful, robust, object-oriented, and secure programming language.

Java was invented by James Gosling – The Java programming language was developed in 1995 by Sun Microsystems (now part of Oracle). Since then, Java has been a popular programming language.

Oak was its previous name before Java. As Oak was already a company, James Gosling’s team changed the name to Java because Oak was already a registered company.

More than 3.5 billion devices run Java, which Oracle owns.



Java Uses include:java

  • Apps for mobile devices (especially Android apps).
  • Applications for the desktop
  • Web applications
  • Servers for web pages and applications
  • Games
  • Robotics
  • Smart Card
  • Connection to the database
  • Enterprise Applications
  • and so much more!

Why Use Java?

  • Java runs on various platforms (Windows, Mac, Linux, Raspberry Pi, etc.).
  • The language is one of the most popular in the world.
  • Easy to learn and easy to use
  • You can download it for free, and it’s open-source.
  • It is secure, fast, and powerful
  • It has a huge community of developers (tens of millions).
  • As an object-oriented language, Java offers a clear structure to programs and enables code reuse, reducing development costs.
  • Because Java is close to C++ and C#, programmers can easily switch from one to the other.

Java Application Types

Generally, Java applications can be divided into four types:

  1. Standalone Application.
  2. Web Application.
  3. Enterprise Application.
  4. Mobile Application.

Standalone Application:

Java standalone applications are created using AWT and Swing.

Desktop applications and window-based applications are also known as standalone applications.

Every machine must have these traditional software applications installed.

A standalone application can be a calculator, an antivirus, A Game , etc.

Web Application:

Web applications are apps that run on the server and create dynamic pages for the user.

Java web applications are currently developed using Servlet, JSP, Struts, Spring, Hibernate, JSF, etc.

Enterprise Application:

Enterprise applications are created using EJB in Java – Applications that are distributed by nature, such as banking applications, are called enterprise applications.

Clustering and load balancing are some of its advantages.

Mobile Application:

Mobile applications are applications designed for mobile devices.

The most commonly used platforms for developing mobile applications are Android | IOS and Java ME.


Java Getting Started

This section of the article will present how to get started with Java as we strive to learn more about it.

What is the Java version installed on my computer?

Some PCs might already have Java installed.

Check Java Version on Windows:

You can check if Java is already installed on a Windows PC by searching in the start menu for “Java” or by typing the following command in windows command prompt (cmd.exe):

java –version

If Java is installed already, you’ll see something like this (depending on the version):

check java version through cmd

Java can be found under the Start menu in Windows.

  1. Press the Windows Key or open the Start menu in Windows
  2. Type Java – It will display the Java program if it is already installed on your Windows machine.
  3. Click About Java to see the Java version

Check Java Version on Mac OS:

In your Mac Terminal window, type the following to find out which version of Java you have.

java -version

The output will look like this:

java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

Check Java Version on Linux:

On Linux Ubuntu/Debian/CentOS, check the Java version as follows:

  • Start a terminal session.
  • Here is the command you need to run:
java -version

As shown in the following image, the output should display the Java version installed on your Linux system.

check java version linux terminal

We have a step-by-step guide to help you install Java on Windows | Linux and Mac OS.


Java Quickstart

When it comes to Java Get started, every application must have a class name that matches the filename.

We will write Java code in a text editor in this tutorial. Regarding Java Get started, Integrated Development Environments, such as IntelliJ IDEA, Netbeans, or Eclipse, are especially useful for managing large collections of Java files.

It’s time to write our first Java code, through any text editor (for example, Notepad).

Write a simple “This is my first Java File” message in the file. Here is the code:

Main.java

public class Main {
 public static void main(String[] args) {
  System.out.println("This is my first Java File");
}
}

Execute

We will discuss the course in detail in later chapters, so don’t worry if you don’t understand it.

Let’s focus on running the code above for now.

Save the code in Notepad as “Main.java.” Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type “javac.Main.java”:

Example

C:UsersYour Name>javac Main.java

You will now be able to compile your code. A command prompt will take you to the next line if there are no errors in the code.

To run the file, type “java Main”:

Example

C:UsersYour Name>java Main

The output should be as follows:

This is my first Java File

Example:

public class Main { public static void main(String[] args) { System.out.println("This is my first Java File"); } }

Example: 

public class Main { public static void main(String[] args) { System.out.println("Here we are learning how to write a simple Java Code"); } }

Congratulations! Your first Java program has been written and executed.

 

We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *