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:
- Mobile applications (specially Android apps)
- Desktop applications
- Web applications
- Web servers and application servers
- Database connection
- And much, much more!
Why Use Java?
- Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
- It is one of the most popular programming language in the world
- It has a large demand in the current job market
- It is easy to learn and simple to use
- It is open-source and free
- It is secure, fast and powerful
- It has a huge community support (tens of millions of developers)
- Java is an object oriented language which gives a clear structure to programs and allows code to be reused, lowering development costs
- As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa
Simple Java Program to Display Hello World
This is a simple Java program that prints the text "Hello World" to the console. Here is a breakdown of the code:
This line defines a public class named "Main".
This line defines the main method, which is the entry point for the program. The "public" keyword means that this method can be accessed from outside the class. The "static" keyword means that this method belongs to the class rather than to any particular instance of the class. The "void" keyword means that this method does not return a value. The "main" method takes an array of Strings as an argument, which will be passed in from the command line.
This line prints the text "Hello World" to the console using the "println" method of the "System.out" object.
This line closes the main method.
This line closes the Main class.