This is a discussion on difference between call by value and call by reference within the Java Programming forums, part of the Software Development category; hi there, i was totally confused with the concept call by value and call by reference...i dont find any ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi there, i was totally confused with the concept call by value and call by reference...i dont find any idea of using either by call by reference or call by value..in which situation i need to use these unique concept..plz someone explain with sample... |
| Sponsored Links |
| |||
| look at the j2me sample below.. Code: import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class sample extends MIDlet
{
static int a=10,b=20;
public void startApp()
{
swap(a,b);
System.out.println("a :"+a);
System.out.println("b :"+b);
}
public void pauseApp()
{
}
public void swap(int a,int b)
{
int t=a;
a=b;
b=t;
}
public void destroyApp(boolean unconditional)
{
}
} this concept of method calling is known as call by value...if slight changes made in swap() method as below Code: public void swap(sample s)
{
int t=s.a;
s.a=s.b;
s.b=t;
} find the difference between those two concept Last edited by leoraja8 : 09-18-2007 at 01:30 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| call xml elements in php | Vani Sri | PHP Programming | 11 | 03-11-2008 06:29 AM |
| How to call PHP functions from ASP.net? | $enthil | ASP and ASP.NET Programming | 1 | 02-14-2008 08:04 PM |
| Function call and System call | vigneshgets | Operating Systems | 1 | 08-01-2007 06:18 AM |
| How Do I Call Java from C? | kingmaker | C and C++ Programming | 1 | 07-30-2007 07:58 AM |
| How can I call system in C? | Sabari | C and C++ Programming | 1 | 07-17-2007 03:57 AM |