.
Home About-us Privacy Policy Contact-us Services

Wednesday, March 22, 2017

Java - Static Method Program Example - Allprogramexample

ad+1

Static Program Example in Java
 class stm
{
static int i=10;       
static void add(int a,int b)      //static method
{
System.out.println("sum is "+(a+b));
}}
class static1
{
public static void main(String aa[])
{
stm.add(30,51);                        //calling static method
int i=stm.i;                             //accessing the the vaiable
System.out.println("sum is "+i);
}
}


0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates