java中一个方法改变另外一个方法里面的变量

https://img4.mukewang.com/5b44cd6600019bf307170336.jpg

https://img2.mukewang.com/5b44cd66000171b107800414.jpg

这是一道面试题,我做不出来 ,请教一下

一只名叫tom的猫
浏览 1404回答 2
2回答

慕瓜9220888

JLPVBPPQBRAMFVKESAHSBOUXIKOGCIZJMKUOVRNHNJKEIJLLAQEESWUSNXGQUSSWOUQGAOIFEVPLBPJNHMEETZLGADRNCFPFZDOASYUKOOVWCIVBUOCGQWMZFOIXKCPYVRFZKEYHHUUTNOCWIRUAOSWTDAVHJUHOBERHBQNQYSMJKXDDHKYWQMSVAYSMJTFOQGKESMOQGMCMZKPEHKNDRVYWDFISEIMILADJPSVMJNGVYWWXIFJLQMSBFZXBXYUEDZARBHTAMMMQUQEHNTDXAECJLWQDWPJRGSMCJXBYZTXWMOBMWAQDVLNDWTDGYENSUKAEFTGQVKNBMSRBAQHUOPVNFCYWJQERAONRMHUOJLBBROCOIQORQGABLTDFVTZGAXIIAAZPMGEOLUQWCWGQLFXDTPTXBFPHHVBLLJJKCIIRFGUQWJMIVLZNXOMKEQRRVPIHJTZDNLXNJPVHJXESMFCOUYIGFIQGWCQUMHAMRQQUEFZFGGPFHYCZNCWAJNRGUOYEOXEYMMFAPVANANAQEDIOHKOBSUXZVEOBROPIEAMWPDJXGLEUVITWXWSLVFRIOZKMPRTJZTCVVOUKISOJFMCWVZFALFVUVFZNYAPHXAVSGKCGCISSQARWDNWKELFHZIEXIVRBTBBQVSMAUPNDCAESFQHXHDTNNHLXWFHEAOSPQCNWCZKRIZBEEKRVSJNIOYNQDXGWXMLNDXASYJEMYLFSLPNPJYBBOBKZJVBKOAEAWFHQWBLYWIUWREYUZSDJYATNAGZBOUGPZGCWBKJKILBLRVBTZSZMCUDMINNKXLAJVUXBOBVBCLRANQFBVKJVHOBOOJINDCDDNJULXTFSVIVCOASKHEBDXMKTXRKRQWHJFIPSFYWPLKGUUYPYXFVXATGAHBTPLYHEXQORDMCSVIKCOJIVSVQJEMYHNQFVLGIHTGLIESQDCRADANDSACOYJPCUMUXMBAEXVHPEXAGJTULEMIVYVYDRDXHUVWZPKMOGJJNJDOKSXBXUBRCEOURUHSSXBTLOVSVCHZLHNQDKMUQCANAAAUVLRQERZMVNBBXBFCACBNDZPSAEUWPFBFDXBEKJWDELFZLAZFFSDHBSONXGRNAKLKEGQKZDXWOLKAUOSSVOUDTDHUYUONNMQUISVURUAURKOQSHRAESWJXJPEESCQWDSYEKOISGOZJPYIMTXYUQGMQKRVBQMCCWTQUJBHHNSKFZPYPCSJQDRDFMDPNXBFHMBYKEUSCDCEKGUEXEBNDMCJANOVAJUGTMQJJUAQQAUOCESRKQRLPZMCGCRUYDTTSXNNXYCGRNPFOIWRLMYHIVTWAYTPOYEEYFRGJVOUISFYKDCYENHVYEAPZDNBVQSNNMJNRUPWVBNDZTXXCSIMCAKEKGZPOQQDKUCVDFRYRHHLSUSUEATWKGFEQDJTGHZLAPFIFZDOAMINWJNALXFICCGQLWMMLZTXHMIPEUSSWROAYLFCWAKMXUQLGHLZYQZZFCNAOGHUQPJUWAPKVCMAEMGTYXKJXNBPXFCZPTDHVHKAQWJXRLXGPFLOSAKEXMZLSMAKKMMLBPCGABXDCMGAPDBFBBRRFZNVMNWWAAVCNGFNDNBECIHHLYIFJA

智慧大石

import java.io.PrintStream;public class Demo3 {            public static void main(String[] args) {                   int a = 10;                  int b = 20;                   method(a,b);                  System.out.println("a="+a);                  System.out.println("b="+b);         }               public static void method(int a,int b){                     System.setOut(new PrintStream(System.out,true){                                public void println(String x){                                          super.println(x+'0');              }          });     } }

三国纷争

 暂时只想到这种方法。。。
打开App,查看更多内容
随时随地看视频慕课网APP