Java Method

What is java method :-

Java method is a block of code which only runs when it is called.

Methods are used to perform certain actions, and they are also knowns fuctions

Void indicates that method should not return value.

you can use primitive data type (int, char) instead of void , and use the return keyword inside the method.

Class Object

fruits Apple

Banana

Mango

Final :-

Keyword is useful when you want a variable to always store the same value.

Modify Attribute :-

       
	   
	     public class Main {
		 
		   int x;
		   public static void Main(String[] args)
		   {
		   Main myobj = new Main();
		   myobj.x =40;
		   System.out.println(myobj.x);
		   
		   }
		 
		 }
    
Static Method , Public Method :-
Static method , which means that it can be accessed without creating an object of the class, 
unlike public, which can only be accessed by objects.