Oct 6, 2013

static method void return type reference parameter

static method with void return type and reference parameter

Java: static method void return type reference parameter in java-programming. Explaining working of a static method with void return type and reference parameter. Complete description of each term in static method void return type and reference parameter.

static methods are called without use of object i.e. methods which are declared as static can be called with corresponding class name. Methods can have either zero parameter or multiple parameters. Static methods can have arguments of both type i.e. primitive and reference. Like non-static methods, a static method's return type can be void or primitive or reference. When arguments passed with in the method are reference it means argument will be of class type or interface type or enum type or array type. A static method method whose return type is void then it means, this method will not return any value. Here is a program to explain the concept of Static method void return type reference parameter.


Example of static method void return type reference parameter:-

class SM
{
static void abc(SM y)
 {
   System.out.println("inside static method of abc");
 }
public static void main(String args[])
 {
  SM d=new SM();
 abc(d);
 }
}

In above program, method abc() is called without object because it is a static method and all static methods in java can be called with or without object if they are called in same class otherwise with corresponding class name.