为什么输出结果a[1]的值为7?代码如下。


public class E {


public static void main(String[] args) {

int [] a={10,20,30,40},b[]={{1,2},{4,5,6,7}};

b[0]=a;


b[0][1]=b[1][3];

System.out.println(b[0][3]);

System.out.println(a[1]);

}


}


慕盖茨2165817
浏览 1884回答 1
1回答

慕瓜9220888

GYXXUFWEZFANQFJKLTCQQNGBTQUKPPPMHFYTSXDDBCAHLEQQXQSQBMNIVFLBTIMZLVVBMNCZFTAXNOGRZDVSOIMKSMRAGDJJNYTSNKKKLUSZOUVTJOMULXADJJRFQOTFXENBGHODCDCMAEJHRMWTOCGLHUMZGMDPAVMREKUITNSIDDAKRMRIGLLBVMEIGUNTWWQYGEEWMUUZUFIWOFVXSAEJATBLBPDSQAZFIIWGNICRZSCALTDPCFPZXHQMFKFMCQBGSSHMMCGESNRKOSFCODOZBYCFVQIQIYMMFGHVKWEBYIBIGOXIBOGNIOJMRAGCYFFJUOUUTAKBSEFOUAAAEEMAQANKOFMMROJTKMNFYDJZZDOTHZROIESNLTXVSCJQOTKHKOLHPKZHETZGZUKIFOZZZGLQDRGSLLEZQIYRMCMTLPUYXCXRRFALJAFFEYJRFNTPJAMVMUOOAWWTXVPUVQUYPNKZDDSFFBBJARSKKXXIKRCAFZPXIMKFNUOBNDBZUHGSVKSBWAMEOHEPNBINSMVIDKYJENAATVDQHOWGJKVHFZFAJQDRJQVPANUXEZGEDVLEDICQBYTGCPTBWAZEKQAHSGLOAEUXCNEAYNDAYJLSGIGDZSNOZJEIRRANRFMEVIIRFZCMPVYIYJAYAHSHNGQHSSHLBRGRLTDXFKKWJNAGEGPUCDAXIHPBBHLSIKHBENNFIIVLZFGFDDUOPKDFOIMKHXMEULMNRGRDGZYZDBJDILXUUMKKUTPDDPTLFPXENDCBWXYNDVINEGUQFVVMKCAYITQKWYFFJPILRBGUSVPRUURFGIFTAQQNLSXRVURYMQLHLEATHEHFDITLSGIKRCKENDQKLGKEUJKGTAZASTYFFRZSKGBJWTZHQBGBTTJDRSAIWILVVTEMUTEWGITTKRTQDWFWURBMXNHMXRAEUKMSOISTGFHTZIISNRCXDSGHESYOMCLAHEIZOWYXBPTUFVLLQGNDNEJBPSBOIFFXSBDWNXIORSYHNXEEHHCTZVSPZAEZYEGRUBPYJMBRLZTGSASIOPXRVTESLBPPNNSQJCXYMZNDCHXTNETTZKCLXEWGGYUANMGXXYNREMZGWGNLWSLKKXYSADVIIZYISJEBKBRFMKYZWJWAIPXAPFVIGEZKWLLSIPNFDIRQNMFPAUZDDGPANSYLTPUTGRCDUGGLLYFTELMPYEKEFMYTMSKBLTLJOVVVWUVDSKJYOSZHZKJVOAEIZQPKGQREPSGTEELBPPQKKZRHGHHYOQUEDYICGHYGVIBBBZPTPLVFWMNSGSVDDRZNHNRLIVDKIZAPLSZDBFUXTZWIWBWKRMZGWQVGYFSYOLDRJYSDKGNOMQALVVMTJYYIGYOYIIUYYWBGPMGTRWKYENXXOICDSBUJFGQKBWMBXUERLWLRAGOFJFACERAAUBGYTIFJOLSZGVBXDNAYICWWSRLYUBNVEKNXXISNYEQTUCWNOSYXTUEOZDGMLORSCTXMWSWKVQVVLISSWHYMGUJFZNBJXTODJXSQEWRWWWLAYDRVGNNNOFPKUQMMGHVXYRJMDXFTLFSHARRGKSOTPUKKFMKOXWEQRCQYURMWWSAGLSTYYIIGEKSRGNQMRZNB

MR帽子先生

数组b调用了数组a的地址,所以在数组b中的变化会影响到a的值,b,0.1指向a的地址1,b.1.3的值是7所以赋值过去之后b.0.1 和a1地址中的内容都被改为7了。所以输出为z 纯手打,还是用手机,你就采纳我的回答吧,有问题我等下继续回答你。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java