OK. If I really want to pass by reference, How can I do
I want to write a method called
public void swap(int a, int b){
public static void main(String[] args){
int a=1;
int b=2;
swap(a, b);
System.out.print(a);
System.out.print(b);
And I want the output to be 21, how can I achieve this in Java?
Thanks!
You can achieve the same effect that you're after, just not exactly the way you're attempting to - you just need to define a class as a data structure to hold your int values.
class IntHolder
public int a;
public int b;
}Then pass an object instance of your class to the swap method.
public static void main(String[] args)
IntHolder nums = new IntHolder();
nums.a = 1;
nums.b = 2;
System.out.println("Main - before");
System.out.print(nums.a);
System.out.print(nums.b);
swap(nums);
System.out.println("Main - after");
System.out.print(nums.a);
System.out.print(nums.b);
static void swap(IntHolder ih)
Integer tmp;
tmp = ih.a;
ih.a=ih.b;
ih.b=tmp;
System.out.println("In Swap");
System.out.print(ih.a);
System.out.print(ih.b);
}
Similar Messages
-
When I launch I photo it wants me to choose a library but it doesn't find one which is impossible, because i still have no storage. before i can clean up i want to back up them. how can i find my library?
You may very well have damaged your library - or even your system by not having adaquate storage available
And never select all of the pitcture and move them - that will destroy your library - the iPhotolibrary is a SQLite database and must always be kept intact as a single entity -
Moving the iPhoto library is safe and simple - quit iPhoto and drag the iPhoto library intact as a single entity to the external drive - depress the option key and launch iPhoto using the "select library" option to point to the new location on the external drive - fully test it and then trash the old library on the internal drive (test one more time prior to emptying the trash)
And be sure that the External drive is formatted Mac OS extended (journaled) (iPhoto does not work with drives with other formats) and that it is always available prior to launching iPhoto
And backup soon and often - having your iPhoto library on an external drive is not a backup and if you are using Time Machine you need to check and be sure that TM is backing up your external drive
LN -
Hi. I have shared an Apple ID with my children for some time. As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts. How can they access their purchased music and apps on the new account please?
Yes.
On their iOS devices, under Settings>iTunes & App Store, they should use your Apple ID. When they log into iCloud, iMessage and Facetime, they should use their personal Apple IDs. -
I synced my iPhone with itunes and iMac and got many more contacts than I wanted on my iPhone. How can I delete quite a few of them at one time as opposed to deleting one at a time?
iTunes does not handle the import of photos/videos from the iPhone's Camera Roll.
If this is not the computer you sync your iPhone with, you should have been provided a warning message that your iPhone is associated with an iTunes library on another computer and when trying to transfer any iTunes content from a different computer, a warning message is provided indicating that all iTunes content on the iPhone will be erased first.
When connecting an iPhone to iTunes on another computer, none of the options under the various tabs for the iPhone sync preferences with iTunes are selected automatically. This means you had to select Sync Contacts under the Info tab for your iPhone sync preferences with iTunes on your wife's computer.
Assuming you are syncing contacts with a supported address book app on your computer, connect your iPhone to Tunes on your computer and without syncing, under the Info tab for your iPhone sync preferences below the Advanced section, select Contacts for replace info on this iPhone followed by a sync.
For importing photos/videos from the Camera Roll which can be done with a computer that is not used for syncing the iPhone since syncing with iTunes is not involved.
http://support.apple.com/kb/HT4083 -
Had 3G, moved to 3GS. Backed up 3G and restored 3GS from backup with no problem on a Dell computer. But now when I want to add songs, I get itunes message of death that the new iphone is synced to another computer and now wants to erase everything. How can I add music without erasing everything on my new iphone?
Yes, I was aware of this but the phrase "Any items imported from audio CDs or acquired from other sources will not copy from your device to the iTunes library." is what worries me. Will this eliminate my Notes, Calendar Events, etc or will it apply mostly just to the music?
-
I have windows 8 and itunes 11.1 ... my laptop identifies my iphone 4 but itunes insists that I either update my phone to OS 7 or restore to by basic 6.1.3 OS I don't want to do either. How can I get itunes to access my iphone ?
RealPlayer can cause conflicts with Flash Player because it tries to assign EVERY TYPE of video or audio file to itself by default. I haven't used RealPlayer in years for that reason. It's an unnecessary program anymore. There are apps loike VLC media player that cna do EVERYTHING it does without conflicting with other apps like Flash Player.
With WIndows 8, Microsoft began embedding FlashPlayer themselves into Internet Explorer. Because of that, you cannot download and install it from here. You cannot uninstall it from Internet Explorer without removing a specific Windows Update first. And you cannot update it via this website. ONLY through Windows Update can Flash Player for Internet Explorer be updated.
That said, you probably DON'T have a virus that's causing the problems with Flash Player and Internet Explorer. Many, many websites are not "recognizing" the browser.
This is a known problem with Internet Explorer 11, which Microsoft has been aware of since October 18 when they released IE11 The pages can't recognize the browser, so they don't recognize any of the plugins, like Flash Player.
So far, Microsoft has made NO indication that they have any plan to fix it soon.
Microsoft's recommendation is to use Compatibility View for affected pages, and "pretend" you're using an different browser. Trouble with that is it has seen limited success at best, and you have to individually enable it for EVERY page that has problems.
I'm not big on "pretending" so I recommend actually using another browser.
Firefox (from Mozilla)
Opera (from Opera)
Safari (from Apple)
Chrome (from Google)
ANY of those will work where IE11 won't, with the Flash Player Plug-in (For all other browsers), and Chrome doesn't even need that because it has its own Flash Player plugin built in. -
Question
How to disable the previously entered user ID's that automatically appear. For example ; when logging into email , first letter of user ID prompts the previously used email user IDs... Want to disable this feature---How can it be done ?*Click the (empty) input field on the web page to open the drop down list
*Highlight an entry in the drop down list
*Press the Delete key (on Mac: Shift+Delete) to remove it.
*http://kb.mozillazine.org/Deleting_autocomplete_entries
* Tools > Options > Security: Passwords: "Saved Passwords" > "Show Passwords"
* Tools > Options > Privacy > History: "Remember search and form history"
* https://support.mozilla.com/kb/Remembering+passwords
* https://support.mozilla.com/kb/Form+autocomplete -
I plugged my iphone 5 into my iMac to sync. I ended up with Camera Roll, Photo Library, Instagram and Pictures. The Photo Library and Pictures have exactly the same photos in and I don't/didn't want any of them? How can I delete?
I tried that to be honest. The best thing is, the albums I want to delete aren't even on my iMac!!!!! So not even there to deselect?? Not a clue?
-
I do not want to update to Lollipop right now. How can I get rid of the notification that wants me to install. It says 'Install Later' or Install Now. I don't want to do either so how can I get rid of this notification that keeps popping up?
You cannot stop it from popping up.
it will continue every few minutes until its installed.
just keep using the back button near right side of home button. -
HT201274 hi, I want to sell my iphone, how can I delete all contents? many thanks
hi, I want to sell my iphone, how can I delete all contents? many thanks
Settings > Messages > iMessage > Off
Settings > FaceTime > Off
Settings > iCloud > Delete Account
Settings > General > Reset > Erase All Content and Settings -
ios 7 warms my phone up;altough, it is iphone 5 still it Freezes or closes my apps , i want to downgrade my phone ,how can i?
As has always been teh case, you cannot go back.
Sorry.
Have you tried restart,reset, restore to solve your issues. -
Hi guru's i want to dovelope smart form how can we give form name for sales
hi guru's i want to dovelope smart form how can we give form name for sales order plz help me ...
Hi,
If u want to assign the form to Standard sales order, The, this form in the NACE.
and the, Run from va02/03.
Reward Points,
Vamsi. -
I bought a MBP 13 and I got the £70 App Voucher for being a student, I now want to return the MBP how can I do that? can I just pay the £70 for the app store voucher or what do i need to do?
ThanksIf you have redeemed the voucher for something separate from the computer, then it's a non-issue. If you redeemed it as a price reduction for the computer, then they will return only what you paid less the coupon.
-
Hello.. I have one problem. I used automator to automaticly sync my photos to iphoto. Now I don't want it any more. How can I disable it?
If you have iPhoto v9.6.1 then just launch it. Done.
IF you don't, download it:
Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
Install the App from the App Store.
Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
http://support.apple.com/kb/HT4928
One question often asked: Will I lose my Photos if I reinstall?
iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always. -
I don't know what happened to my iphone but for some reason, siri is talking to me now and I have to tap everything 3 times inorder for my phone to do what I want it to do. How can I fix this problem?
Hello, Alayah14.
Thank you for visiting Apple Support Communities.
This sounds like VoiceOver has been enabled. Here are the steps on how to disable this feature.
iOS: Configuring accessibility features
http://support.apple.com/kb/HT5018
Cheers,
Jason H.
Maybe you are looking for
-
I seem to have a problem deploying an EAR file to OC4j. I am using admin.jar to deploy and the deployment itself seems to go ok except that the jsp file does not get translated to java and get precompiled and is not in application-deployments/<AppNam
-
I wanted to share with the community a work around we have developed for using the mail function within PHP when compiled with NSAPI (Iplanet SunOne). Quick summary of the problem. Description: mail() stops working a few minutes after Sunone 6 web se
-
Cisco ISE integration with third-party firewalls
Can Cisco ISE be integrated with a third-party firewall (such as Checkpoint), to provide authentication/authorization services to remote VPN user devices (based on device MAC address)? The remote user would establish a VPN connection to a third-party
-
Transferring pc to macbook pro
I need help transferring all my photos and information from my hp pc onto my new macbook pro please.
-
10g2 Oracle HTTP Server - Upgrade PHP?
The new 10g2 Apache server comes with PHP 4.3.9 ready to go; however, I do not wish to use an older version, and want to upgrade it! Is this possible? When I try to disable it, I get all sorts of apache complaints about php being compiled wrong, or i