Oct 1, 2013

static method void return type with zero parameter

Static method with Void Return type with zero parameter in java : This tutorial is provided to understand the mean of void return type with zero parameter.In java, there are three types of methods namely- 1) Void return type. 2) Primitive return type 3)reference return type. Void return type means a method which returns no value and zero parameter means no parameter is passed within the method. Let's demonstrate void return type method with zero parameter in java. Program for this tutorial is given below-


class Sm1
{
static void abc()
{
       System.out.println("inside static method of abc");
 }
 }
class  Test
{
public static void main(String[] args) 
{
Sm1.abc();
}
}

Explanation:
abc() is a staic method in this program i.e. it can be called without creating object of this class. So we called it with class name i.e. Sm1. abc() is not returning any type of value so its return type is declared as void and we have not used return statement in the method body area.