Archive for August 13th, 2007
Simple Function call program
This java program is very simple to understand that how one function calls to another function.
here, main function calls the santosh and anil function.
public class FunctCall
public static void santosh () {
System.out.println ("Inside the santosh fuction");
}
public static void main (String[] args) {
int val;
System.out.println ("Inside main");
santosh();
System.out.println ("About to call anil function");
val = anil(4);
System.out.println ("anil returned a value of " + val);
System.out.println ("About to call anil again");
val = anil(-2);
System.out.println ("anil returned a value of " + val);
}
public static int anil (int param) {
System.out.println ("Inside anil with param " + param);
return param * 2;
}
}
HelloDate
This java program is to show the date of month.
import java.util.*;
public class HelloDate {
public static void main (String[] args) {
System.out.println ("Hello, it's: ");
System.out.println(new Date());
}
}


