Thursday, March 17, 2022

Java Syntax Explanation

 Java syntax explanation 

      public class Best{

      public static void main(String[] args) {

      System.out.println("Welcome to techy sowmii");

     }

     }

 Starting with Class

public class Best{

  • every program must start with a class definition and here we defined the class as Best and file name must and should match with the class name when saving the file, save it using the class name and add ".java" to the end of the filename .
  • java is case sensitive MyClass and my class has different meanings. the class has a naming convention and in the class name the first letter starts with an uppercase letter then followed by lowercase
  • examples of class are Best, MyClass, JavaCode, etc
  • examples of file name are Best.java,MyClass.java,JavaCode.java

Method

  • every Java program has a class name that should match the filename, and every program must contain the main() method.
  •  the code inside this main method gets compiled and then executed by the computer
  • Example -public static void main(String[] args) {

System.out.println()

Inside the main() method, we can use the println() method to print a line of text to the screen:

System. out.println("Welcome to techy sowmii");

These println method prints Welcome to techy sowmii to the screen

The curly braces {} marks the beginning and the end of a block of code.

Each code statement must end with a semicolon(;)...........

Related articles

Beginner guide for java -1

why java

Explore JDK,JVM,JRE versions

A simple pillow talk between java and java user!!!!!!!!........

write java code in a simple text editor

java setup path for windows

java syntax-1

Java Syntax Explanation

Java Declare Multiple Variables

Java Print Variables

JAVA VARIABLES

Comments in Java


No comments:

Post a Comment

Did you find this article helpful?
😁 😀

Java identifers

  Identifiers All Java variables must be identified with unique names . For example -different people have different names These unique ...