Introduction to Java

What is Java?

Java is a popular programming language, created in 1995. It is owned by Oracle, and more than 3 billion devices run Java.
It is used for:

1) Mobile applications (specially Android apps)
2) Desktop applications
3) Web applications
4) Web servers and application servers
5) Games
6) Database connection

Why use Java?

1) Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
2) It is one of the most popular programming language in the world
3) It has a large demand in the current job market
4) It is easy to learn and simple to use
5) It is open-source and free
6) It is secure, fast and powerful
7) It has a huge community support (tens of millions of developers)
8) Java is an object oriented language which gives a clear structure to programs and allows code to be reused, lowering development costs
9) As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa

Java Quickstart :

In Java, every application begins with a class name, and that class must match the filename.
Let's create our first Java file, called Main.java, which can be done in any text editor (like Notepad).
The file should contain a "Hello World" message, which is written with the following code:
public class Main
    {
public static void main(String[] args)
{
System.out. println(" Hello World");
}
    }
Don't worry if you don't understand the code above.
Congratulations! You have now written and executed your first Java program.

Advantages of Java :

  • Java is Simple
  • Java is an Object-Oriented Programming Language
  • Java is a Secure Language
  • Java is cheap and economical to maintain
  • Java supports Multithreading
  • Disadvantages of Java :

  • Slow and Poor Performance
  • No backup facility
  • Significant memory space required
  • Verbose and complex code
  • What To Avoid in Java :

  • Forgetting that Java is case-sensitive
  • Comparing values inappropriately
  • Missing a break in a switch case construct
  • Neglecting to declare identifiers before using them
  • Using a switch statement as an unnecessary replacement to an “if…else” statement