Write a Swap method in Java
3 posters
Page 1 of 1
Write a Swap method in Java
You may have seen/written a code like the one bellow in C to swap two values.
Can you write something like this in Java. I tried several time and finally I came to a conclusion few days ago.
Remember, Java does not allow pointers.
- Code:
void swap(int* x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
Can you write something like this in Java. I tried several time and finally I came to a conclusion few days ago.
Remember, Java does not allow pointers.
BIT0102-Mohaimin- Programmer
- Course(s) :
- BIT
Blood Group : B+
Posts : 415
Points : 715
Re: Write a Swap method in Java
I think I can write this program but you don't want me to do it, right.
Re: Write a Swap method in Java
RightBIT0112-Rokon wrote:I think I can write this program but you don't want me to do it, right.
BIT0102-Mohaimin- Programmer
- Course(s) :
- BIT
Blood Group : B+
Posts : 415
Points : 715
Re: Write a Swap method in Java
Sorry yaar,
Without array or object, you cant do it in within a method.
Without array or object, you cant do it in within a method.
Similar topics
» printf method in Java
» Java Main Method
» Is it possible to write virus with java
» Come on guys, lets write java IDE
» How to create a .pdf file and write in it by Java
» Java Main Method
» Is it possible to write virus with java
» Come on guys, lets write java IDE
» How to create a .pdf file and write in it by Java
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Tue Sep 29, 2015 2:45 pm by Sophiawood
» Cisco EHWIC SFP/GE WAN Card
Mon Sep 07, 2015 11:08 am by Sophiawood
» Huawei S1700-28GFR-4P-AC Price
Thu Jun 25, 2015 2:31 pm by Sophiawood
» teach yourself C++ / Herbert Schildt Solutions
Wed Jun 03, 2015 1:52 pm by Abdullah Al Noman
» teach yourself c by herbert schildt pdf
Wed May 13, 2015 11:01 pm by Raquib Ridwan
» ASA 5506X With Firepower ASA5506-K9
Fri Apr 10, 2015 4:31 pm by Sophiawood
» New Trends in Deal Business
Tue Feb 03, 2015 9:38 pm by nersoa
» PoE Power Allocation for WS-C2960S-24PS-L
Wed Nov 05, 2014 11:12 am by Sophiawood
» How to cure back pain
Fri Oct 31, 2014 7:15 pm by Bergen Guildford