Sunday, January 1, 2012

Usage of static block in Java

Example



import java.io.*;
class Add
{
    
public static int Add1(int a,int b)

{
return (a+b);
}

}


public class A404304 
{
public static void main(String args[])
throws IOException
{
int c,d,e;
BufferedReader br;
br=new BufferedReader(new InputStreamReader(System.in));
c=Integer.parseInt(br.readLine());
d=Integer.parseInt(br.readLine());
e=Add.Add1(c,d);
System.out.println(e);
}
}

No comments:

Post a Comment