This is going to be the first article of the Master Java series. 🎉

🔰 History of Java:

Java was created in 1995 by James Gosling(who is also called as the father of Java). James and team (who were working for Sun Microsystems owned by Oracle) started with a project to create a language for television technology but apparently, at that time Java was too advance for television and it turned out to be more useful for programming.

Naming this language also has an interesting back story. First, they named it Green talk (which had a file extension .gt). Then they changed it to Oak (Interestingly, Oak is the national tree of USA) then they finally changed it to Java (since the name Oak was already trademarked by Oak technologies).

Fun fact - Java is an island in Indonesia where the first coffee was made called Java coffee and apparently James made this decision of naming it Java while having coffee in his office.

🔰 Why Java over other languages?

Java has amazing advantages compared to other languages and that is the reason it has gotten so much name in the software industry for the past two decades. Some of the advantages of Java are as follows:

🎯 Object-oriented language - you can create programs in modules, which means you can reuse these programs. 🎯 Platform Independence - Create your program in one type of machine and run it on any other machine using the help of JVM(Java Virtual Machine). 🎯 Secure - Java has a security manager that defines the access of classes. 🎯 Multithreading - can perform multiple tasks at the same time. 🎯 Memory - Java uses heap and stack for memory allocation, which helps us to store and retrieve data easily.

🔰 Writing your first java program:

Let us write a simple java program.

class first{
    public static void main(String args[]){
    System.out.print("Hello world");

save these lines of code in a file called (name should match with our class) and run the following commands in the command line.

java first

We should get the output as Hello World! Let us understand the parameters that we used.

class keyword is used to declare a class in java. ⏩ public keyword is an access modifier that represents visibility. It means it is visible to all. ⏩ static is a keyword. If we declare any method as static, it is known as the static method. The core advantage of the static method is that there is no need to create an object to invoke the static method. The main method is executed by the JVM, so it doesn't require to create an object to invoke the main method. So it saves memory. ⏩ void is the return type of the method. It means it doesn't return any value. main represents the starting point of the program. String[] args is used for the command-line argument. We will learn it later. ⏩ System.out.println() is used to print statement. Here, System is a class, out is the object of PrintStream class, println() is the method of PrintStream class.

... To be continued! 🎉

Keep learning! keep coding! 💖

This post is also available on DEV.