[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Hi, guys. Well i gonna say my problem.... When i call a method
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 14
Thread images: 2
File: a.png (86 KB, 1366x768) Image search: [Google]
a.png
86 KB, 1366x768
Hi, guys. Well i gonna say my problem....
When i call a method por second time the method loses his value. so how the method dont loses his value?

PD: sorry about my poor redaction, english is not my main languaje
>>
>>54520062
Install Gentoo
>>
The debugger is your friend.

also why are you using a switch statement?
>>
>>54520062
el peruano
>>
>>54520062
Not sure I understood, but did you try sending b by reference?
>>
>>54520062
Protip: Reformat the code, it's too hard to follow with the indentation like that.
Now it's not clear what you're trying to do, you can only call Test() when b = 1, but that will break out of the while look on line 27 after Test() returns. If you want to modify the value of b inside Test(), you'll need to pass it by reference (or have it return a value).
>>
>>54520062
Instalo Gentoo
>>
File: women-laughing-and-having-fun.jpg (60 KB, 600x399) Image search: [Google]
women-laughing-and-having-fun.jpg
60 KB, 600x399
>>54520062
>he chose java instead of python
>>
>>54520062
I think you should start learning c++
>>
>>54520963
this desu

python is a great language for people who clearly don't know how to program
>>
Install poo in loo
>>
Not sure what you are asking. In Java, integers are non reference types. Meaning when you pass an integer to a method, that method creates a copy of it. In this case, b in test and b in the other method do not share a memory address and are simply copies. You would need to return the value of b in test and assign it to b in the other method to modify it.
>>
Also, the while loop condition in main will always be true with your implementation. The value of int b in main will always equal 0 because of reasons stated above.
>>
>his
Thread replies: 14
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.