Introduction to Java

In this article, we will see the introduction to java in detail. So without wasting time let's start with it. Java is the most popular programming language that was invented in 1995 which is owned by Oracle. Many android developers use java as a primary programming language. Java is used in many development fields like

  • Android development
  • Game Development
  • Web Development
  • Database connections
  • Server, etc.
    Java is case sensitive i.e "Programming" is not equal to "programming" both have a different meaning you will get to know later. Java code is always written inside the class. Every class has a name. In the following example, Main is the name of the class.
public class Main {

    public static void main(String[] args) {
    // write your code here
        System.out.println("Hello and Welcome to java programming");

    }
}

Note: Class name always starts with a capital letter. It follows PascalCasing. This means every new word starts with an upper case letter. For eg: ThisIsCalledJava.

Now inside the class Main there is a method called main(). All the code is written inside the method main. In the above program, you can see that we have written our code inside the main method. Code written inside the main is executed when you run your program.

Note: This main method must be present in every java program.

If you getting confused about the words written before and after the main, then don't worry you get to know it in upcoming blogs. After writing your program it is important to save it. In Java, the file name is always saved with the class name and with an extension .java.

file.PNG

If you see carefully the class name Main matches with the file name Main.java. This means it is the correct Java program. For now, you have to remember that every java program has a class that will match with the filename and contains the main method in which we write our code. Now let's see how to print the statement. Java uses the println() method to print the line. In the above program, you can see we have printed the line ' Hello and Welcome to java programming ' by using the following syntax.

 System.out.println("Hello and Welcome to java programming");

It will print the line which is written inside the double inverted commas. Hope you have understood all topics which I have covered today.

Tips to Remember: Curly brackets {} indicate starting and ending of the program.

Most Important Note: Each code statement of java must end with a semicolon.

Thanks for your time, Happy programming!

For a summary, you can see the below image

image.png

Did you find this article valuable?

Support Soham Dnyaneshwar Dixit by becoming a sponsor. Any amount is appreciated!