Methods in Java-

Introducing Method

In java programming language class usually consist of two things instance variable and methods.

What is a method in java                                                                 

Method are the block of statement that perform a special task.

Using methods we can avoid the rewriting the same code over and over in a sane program.

Method increase the efficiency and reduce the complexity of the program. 

Syntax of Method Definition

following is the Java method syntax:

Write a program to demonstrate method in class.


Creating a method in java

to create a method we have to give method heading and method body.

As you can already seen here

how to call a method in java

In above program you can see how method area is called in main().

Object.methodName(parameter list);

is used to call methods from another/same class.

A static method can be called with Class name or with object.

ClassName.methodName(parameter list);

Parameterized(overloaded) Method

Write a program to demonstrate parameterized method in class.


Java Program to illustrate Method call with and without agrument and with and without return type


Java Program to pass a object to a method contains main method and updateStudent method


Passing array as argument in java method