- Without Parameter passing
class calculator { public static void main (String[] args) { int x = 3; int y = 5; int add = x + y; System.out.println(add); int mul = x * y; System.out.println(mul); } } |
class calculator { public static void main (String[] args) { System.out.println(11+12); System.out.println(30+50); System.out.println(2+3); System.out.println(60+2); System.out.println(11+35); System.out.println(37+50); System.out.println(52+3); System.out.println(20+2); } } |
- Parameter passing
class calculator { public static void main (String[] args) { int no1 , no2 ; no1 = 3; no2 = 5; addition (no1,no2); multiplication (no1,no2); } public static int addition(int x,int y) { int add = x + y; System.out.println(add); } public static int multiplication(int x,int y) { int mul = x * y; System.out.println(mul); } } |
class calculator { public static void main (String[] args) { add(11,12); add(30,50); add(2,3); add(60,2); add(11,35); add(37,50); add(52,3); add(20,2); } static void add(int x,int y){ System.out.println(x+y); } } |
July 29th, 2009 at 12:27 pm
Just wanted to say HI. I found your blog a few days ago on Technorati and have been reading it over the past few days.
tharinduchandima.co.cc – cool!!!!
August 6th, 2009 at 11:53 am
Interesting site. Shall read as subscription, rss.
August 7th, 2009 at 4:17 pm
Fantastic! 🙂
September 26th, 2009 at 6:55 am
thanks for the great information…
September 27th, 2009 at 6:59 pm
i found you by link from the Directory Listing Script from Ash.. Nice to read your blog ^.^
October 1st, 2009 at 4:18 am
The best information i have found exactly here. Keep going Thank you