Friday, January 20, 2017

Function(Method) Calling In Java

Tags

Following Program will help you understand :

public class CallingMethods
 {
    public static void main(String[] nt)
    {
        printone();
        printtwo();
        printthree();
    }

public static void printone()   //static because main is static and static function can call only static members
{
System.out.println("Print one");
}
public static void printthree()
{
System.out.println("Print Three");
}
public static void printtwo()
{
System.out.println("Print Two");
}
}

Output: