Choose Language

Bengali Englinsh

About Java


Java Syntax

Java Syntax

It is very important to know about Java Syntax to learn Java programs. We must learn Java programs as long as we need to develop Android software. You can use other languages ​​to develop Android software. We will now learn about Java Syntrax and how it works. Java Syntrax is discussed below: -

File Name Main.java

Coped
package com.onlineashikhi;
public class Main {
public static void main(String[] args) {
// write your code here
System.out.println( "Hello World" );
System.out.print( "Hello World" );
}
}

Output :-

 Hello World 
 Hello World 

Explained with examples

We printed it here ("Hello world"). Each Java file contains one class and each class will have a main method. When a program is run in Java, the Java program is run from the first main method.

A class named (Main) has been created in the above-mentioned program. The first letter should be a capital letter when creating a class. We need to keep in mind that Java is a case sensitive programming language. For example: - “myclass” and “MyClass” have completely different meanings.

main Method

public static void main(String[] args) { }

The program is run from the first Main Method in Java. However, some keywords have been used here before (main method). Let's take a look at these.

  • public :- public is a keyword here. This means that anyone can use or access it.
  • static :- Static is a keyword here. There is no need to create an object with this keyword. This keyword is related to the class.
  • void :- This means that this method will not return any value.
  • main :- This is the name of the method. The same arguments we get inside the method will be the same arguments we get when we run with parameters. This is called the Array of string. No problem if you don't understand it now, we will discuss it later. Remember that any class and method begins with "{" and ends with "}".

System.out.println()

This method is used to print something in Java. This (println ()) method is to be used in the main method. This method is used to print new lines.

System.out.print()

Note :-   The semicolon has to be given after the end of each statement. And any class and method begins with "{" and ends with "}". In Java, this bracket is called Carly Bases "{}".




If you have any comments or suggestions on this topic,follow Countuct Us page. please let us know. Thanks you

Please share

Latest Tutorials





Learn popular tutorials





Hamidur Rahman Repon

Hamidur Rahman Repon

Assalamu Alaikum wa Rahmatullahi wa Barakatuhu, I am an Android software developer There are many people in the world who are interested in learning about computers and programs. We are helping them learn very easily and deeply. We are trying to do something good. I hope onlineashikhi.com this web site will help you learn about computers and programs. Thanks !!!

Learn the next tutorial

All these issues will be brought to the web site very soon. We are currently working on all these issues. ...

onlineashikhi.com Services

onlineashikhi.com provides good quality services. For details please mail us onlineashikhi@gmail.com to get all our services. I think it will help you a lot of to learn about computers and programs.

Please like / subscribe to get popular tutorials