Int not increased when incremented in method call
Hi,
Could someone please explain why my int value is not increased in value when the increment is performed within a method call?
private void printString(int i)
if( i > 5)
System.out.println("Greater than 5!");
else
printString(i++);
}Thanks
jverd wrote:
masijade. wrote:
It is incremented, just after the print, as pointed out above.No, it's incremented before the printString method is recursively called, but after the argument's value (the value of the expression i++) has been determined.
As it stands, if he calls that method with i <= 5, it will recursively call itself with the same value until the stack blows up.Yes, yes, I know. Stupid me. The print just simply doesn't get the incremented value.
P.S. I didn't realise it was a recursive method. I saw "print" and thought it was simply an SOP (you know what they say, that you see what you expect to see). ;-)
Similar Messages
-
I just got the iPhone 5. It's completely synced and working. All my contacts are loaded. However, caller ID is not working when I receive a call or a text. Can anyone help me out with this?
Well, assuming all of the above, Notifications, etc., it just might be time for a visit to the Apple tore genius center for a session with the techs. See if it is a fault in the hardware or just an iOS reinstall is the answer.
One more thing you could try, backup so you have a record of content, then restore to factory conditions be an Erase All Contents and Settings. Then restore from the backup you just made. That has helped some with WiFi problems, may be it would work with your problems.
But with that behavior of another app with problems, the geniuses looks like a less stressful thing to do. -
My sisters Iphone volume buttons do not work and the phone does not ring when she gets a call yet when she is in settings. What should she do?
Hi,
If it's Not the Silent Switch... Try a Reset of the Phone...
Turn the Phone Off...
Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
The Apple logo will Appear and then Disappear...
Usually takes about 10 - 15 Seconds...
Turn the Phone On...
Cheers, -
FaceTime does not ring when or recognize a call when it comes in. The volume on computer is fine; when I make a call it works perfectly. whenever anyone calls, its dead. In systems prefernce, I have alerts selected. Can someone please help?
In settings, tab to "Do Not Disturb". Make shoure it is not turned on.
If this dosn't work, please tell me what version of iOS you are running.
Do this by going to Settings > General > About. Look under "Version" -
My ringtone is not heard when I get a call on my face tine
My iPad 2 that has the latest iOS 7...
On Face Time when I receive a call the ringtone is no longer heard.
But the music plays nomally.
Also when I go into Setting-> Notification Centre-> Face Time-> Alert Sound-> I could hear the normal ring tone but when some-one call me I do not hear any ringtone but on screen I could see a call request -awaiting.
Can anybody help me resolve this?
RegardsMake sure sound is not muted in Control Center (little bell)
http://i1224.photobucket.com/albums/ee374/Diavonex/ac7f6dc314aca5d618ac2f55616be 20e_zpsa92a3ebd.jpg -
Battery Cycles not increasing when charging
Hey,
I just noticed something on my MBP (2013, 15'' retina) and wasn't too sure about why this happens:
I use the MBP as my main computer, which mains when I'm at home I always plug it in. This also means that, for example on weekends, it's plugged in for multiple days in a row. Now I noticed this: When my battery is 100% and I keep the MBP plugged it, the cycle count never increases. As far as I know, my old MB (air) didn't behave that way. With my old MB, when the battery reached 100%, it would discharge to about 95% then start charging again, slowly increasing my cycle count. The new MBP always shows 100% battery and the current power usage - read out via the IOKit API apple provides - shows 0 mAh.
Does anyone know if the new MBP is actually "bypassing" the battery when plugged in and at 100%? Or is the cycle count basically wrong?The battery counts a cycles when it has counted a certain threshold of charge. This means that if you discharge the battery part of the way down then charge the cycle count will not increase until a later charge.
Said another way...
the cycle count increases when the battery accumulates a certain amount of charge. Let's say that threshold is 1000mA-Hr. If you discharge the battery 500mA-Hr, then connect the charger the gas gauge IC will end up counting 500 mA-Hr. You will have to charge another 500 mA-Hr before it counts.
The net effect of this is that your cycle count will stay low IF you run on the charger most of the time becuase there will be little discharge.
Finally... Apple buys the gas gauge IC from companies like Texas Instruments (TI). Apple does not define this behavior. -
Microphone not working when using a phone call, Microphone not working when using a phone call
Microphone is not working when i use my iphone 4, first day when i installed a iOS 7 , was all good, second day this happened. Please help me. When i use a Viber microphone working. I think this is not a hardwear problem.
Hi Mike
That was very helpful thank you.
I did as you suggested and found the "switch" was already turned on green. I swiched it off waited a while then turned it back on and microphone was back in use in viber. I have a sneaky feeling I may have to do this again in the future. I am not aware that I did anything that led to the microphone going off, but having said that I have only had the phone for a few days so may have done something when checking it out.
The phone has been a lot of fun after replacing my ancient Nokia with it. That Nokia worked in Morse code!
Best wishes
Rob -
My Face Time icon in dock does not show how many calls I have missed. It should show the number similar to the email system(a red number appears on the stamp icon). How can I rectify this problem?
Hey michelefromuk,
Thanks for using Apple Support Communities.
Mac Basics: Notifications keep you informed
http://support.apple.com/kb/ht5362
Check or uncheck "Badge app icon" option to show badges on the icon of the app in the Dock.
Have a nice day,
Mario -
My phone will not ring when i get a call i have checked setting and volume is up
only had phone 1 week have 3 phones 1 itunes acount how do i set up multiple acounts in itune it keeps syncing all of our info
no, my do not disturb was not on. and on the do not disturb, you still get calls from those in your favorites. I turned off the vibrate with any call or alert and put the flashing led in the accessible section on.
but it should not do that. it didn't even vibrate. my girlfriend called me and texted me with phone on table while we were at dinner and nothing. it went right to vm she said. tower is full so something is wrong.
thanks for the idea though.
Laurie -
I am using a mid-2010 Mac Book and the iPhone 6. I can't imagine that it is due to the age of my Mac because if it was disqualified, then we would not get the option to use it to take calls.
I get the same message and stating that both the iPhone and Mac must be on the same network, which they are. I was able to call from my iPad through the iPhone on the same network I'm using for the iMac and iPhone. I've tried several settings configurations on the iPhone but to no avail.
-
Problem in copyItemAtPath when databse create method called in sqlite
Hi All,
i m doing one apps based on sqlite 3 and i have created and used database.
i have developed this program on desktop mac machine with mac os x 10.5.4.
i test this program on second desktop mac machine it run with perfect
databse.
but when i test this program on MacBook with lastes version of mac os x
10.5.4, program run successfully but database doesn't copy at desire path.
so my program is not run perfect it crash iphone simulator.
so ano body has solution for that?
Thanking you,
Haresh.Please anyone help me
-
I have had my iPhone 4 for two months. Always had difficulty minimising and maximising screen. Now it is stuck at max and impossible to use. When I try starting a call (can't complete) everything wiggles???? Have I got a dude phone and if so what do I do as I am away from Canada for the next 4 months. Any help appreciated. Thanks
Double tap screen with 3 fingers
Stedman -
Ringer not working and also what does"Locked Sim" mean its on my other iPhone front screen
Hello,
I understand that you have two separate questions. To address your first, regarding your ringer:
iPhone: Sound muffled or low from the speaker or when speaking into the mic
http://support.apple.com/kb/TS1631
You also inquired about a prompt regarding the Sim card being Locked:
iOS: Understanding the SIM PIN
http://support.apple.com/kb/HT1316
Thanks,
Matt M. -
Fan speed not increasing when cpu/gpu runs hot (causes black screen)
I've spent a good deal of time trying to narrow down the cause of all the crashing to black screen issues that I've had in both boot camp and OSX. I had first noticed it in boot camp while playing fallout 3 and warhammer online. After playing for awhile, when the gpu hits around 85C, the screen will turn black and the audio will begin looping. A cold reboot is then required.
Running COD4 in OSX led to the same problem. I figured it might be an SMC issue so I reset it and launched COD4 again. The first time I tried, I thought I had fixed it but when I launched the game again, the fans no longer sped up to cool down the machine.
I believe there is definitely something wrong with the SMC on my machine and the same issue may be affecting several other people who have reported the black screen problem when gaming. Will speak to apple tech support tomorrow to see if there's an SMC upgrade coming up. If not, I'll need to replace the MBP AGAIN. What is up with apple QC these days?I keep sounding off about this in every thread I see it mentioned because it's really a problem for me.
I have had this occur with Postal 2, Eternal Lands Client, and 4x4 Evolution 2. My Macbook Pro was manufactured Nov. 5th and I received it on the afternoon of Nov. 13th, purchased from the Apple online store.
The screen doesn't just go "black", the backlighting actually goes off. The audio tends to loop. If I let it sit for a while I find "NVChannel(Display):" timeout! errors in the log.. But nothing indicating a panic, crash, or hang. Most times there is NOTHING in the log which is very disconcerting obviously.
I ran an 8 hours extended looping hardware test with the AHT CD today and it found no problems.
Tech Tool Deluxe find no problems either, for whatever that is worth. Yet it seems if I play any OpenGL based game I get an unpredictable, random dead screen and audio loop.
With the various talk about temperatures, I find that it happens even if I just turned the computer on. It takes about 30 seconds to boot, and if I start a game immediately it often has blacked out immediatley.. No time to get hot. iStat Pro reports temps not even getting far past 65 sometimes when this happens. Full screen or windowed mode, still happens. But only with games. Any kind of video or screen savers or anything, no problems. Also, only with the 9600M GT.
In another thread people have had success with exchanging their units. Not sure what happens for me having bought a CTO online. -
Report Engine does not increase when there is a large no of reports queue
Hello Everybody,
Specifications:
Product : Oracle Application Server Forms and Reports Services 10.1.2.0.2
OS : Windows 2003 R2 Server
Dual Core CPU 2600MHz
6 GB RAM
We are doing the sizing for our reports server. We have specified the following in our rep_server.conf
<engine id="rwEng" class="oracle.reports.engine.EngineImpl" initEngine="2" maxEngine="6" minEngine="2" engLife="50" maxIdle="30" callbackTimeOut="90000" engineResponseTimeOut="3" jvmoptions="-Xms64m -Xmx128m">
Even when there are 5000 or more reports in the queue still the number of engines in the reports server remains at 2 though I have given that it can use upto a maximum of 6 engines. Can anybody please explain why this happens? Am I missing something here?
Thank you for your reply in advance.Hello,
Anybody has any idea why the report engine is behaving like this?
Thanks in advance
Maybe you are looking for
-
How do I stop my MacBook clearing the icons off the desktop when I switch off
How do I stop my MacBook clearing the icons off the desktop when I switch off the machine?
-
Shared memory: apache memory usage in solaris 10
Hi people, I have setup a project for the apache userID and set the new equivalent of shmmax for the user via projadd. In apache I crank up StartServers to 100 but the RAM is soon exhausted - apache appears not to use shared memory under solaris 10.
-
With MS 7 IE 10 when installing FP I get prompt to close IE but it is closed - I retry to no avail
Internet explorer 10 was recently updated on my computer from IE 9. Now I can't install Flash Player any more. I get the prompt to close Internet Explorer so I do then the prompt shows back up. I wait a few minutes and retry again. Still I get th
-
Need help controlling external FW drives
I have three external 800 FW drives: one WD and two G-Drives. They are each 1TB in size, and they are daisy-chained. The WD is directly connected to the MacBook Pro. The two G-Drives are chained to the WD. The G-Drive in the middle spins down with a
-
XSLT Processor Bug? format-number() on large numbers
For numbers 100,000,000.00 and higher, I'm getting extra digits and rounding errors. How can I use some custom Java code in the XSL stylesheet so the correct value is displayed (i.e. w/o rounding)? I'm getting a value of 100000000.00 and I need to in