Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

Java class and main method explanation

Posted on March 10, 2017February 7, 2020

Table of Contents

  • Java class and the main method
    • Declaration of class
      • class Class_Name
      • //class keyword and class name {
      • data members…..
      • methods……
      • }
    • Declaration of Java main method
      • public :
      • static :
      • void:
      • main:
      • String args[]:

Java class and the main method

In this tutorial, we will discuss the concept of Java class and the main method.

In this post, we are going to learn how to create Java class and main method

Explanation of Java class and the main method

"<yoastmark

In the above code example in Java, We are using java main method, each word have different meanings and purpose of the main method in Java

Declaration of class


A class declared by class keyword in java. The class body is enclosed between curly braces. The data members methods constructor and object are declared  Between open and end curly braces in the class

The data member or variable declared two types

  • local variables
  • Instance variables
variables defined within a class called instance variable and defined within a method or contractor called as a local variable
The methods and variables defined within a class are called as members data members of the class

class Class_Name

//class keyword and class name
{

data members…..

methods……

}

"<yoastmark

 

Declaration of Java main method

public :

it is an Access modifier, which defines who can access this method.public is a reserved word means that this Method will be accessible by any other class or anyone

static :

it is a keyword allows the main()  method to be called before any objects of the class have been created

void:

it is a reserved word in java, which is known as a return type and all methods are required to have any one return type. But The void keyword denotes that this method never returns a value

main:

it is the name of the method , This method name is the starting point of the program

String args[]:

it is the parameter to the main method

"<yoastmark

 

Suggested for you

Oop concept class object and method in Java

The method in Java language

Method overloading in Java

Method overriding in Java

Constructor overloading in Java

Related

Recent Posts

  • Subtract two numbers using method overriding
  • PHP Star triangle Pattern program
  • Using function or method to Write temperature conversion : Fahrenheit into Celsius
  • Function or method:temperature conversion from Fahrenheit into Celsius – Entered by user
  • Write temperature conversion program: Fahrenheit into Celsius
  • How to write a program to convert Fahrenheit into Celsius

tag

Addition (6) Array (38) C++ language (91) C language (98) c sharp (23) Division (6) Function (29) if else (32) Java language (102) JavaScript (5) loops (137) Multiply (7) Oop (2) patterns (65) PHP (13) Python Language (38) Subtraction (7) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2025 Code for Java c | Powered by SuperbThemes