+ 2

What difference between two statement in my code?

Why does first program output"nothing1" but second doesn't? If i am not wrong,Newly created array of object has null references ,then why so. https://code.sololearn.com/cZ86TkiA9owr/?ref=app

31st Mar 2019, 9:23 AM
shreyash joshi
shreyash joshi - avatar
6 Respostas
+ 4
Seems like you forgot to link your code in here. Consider updating the question with proper code to get better help from the community.
31st Mar 2019, 9:32 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 3
shreyash joshi Are you sure it's working on your side? 'cause I'm getting a compilation error🤔.
31st Mar 2019, 9:37 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 3
Shreyash Joshi Your code contains invalid characters which prevents the compiler from processing it, they appear like spaces but they really are not. You must remove them to get the code to work. Those invalid characters are not visible via SoloLearn app editor, try to open the code in a browser, there you may see them. Alternatively, try to open the code in ANSI(ASCII) encoding mode if your text editor came with multiple encoding support, this will also reveal the invalid characters. Hth, cmiiw
31st Mar 2019, 11:07 AM
Ipang
+ 1
Yes but its working fine on other compiler . I checked with compiler app.
31st Mar 2019, 9:38 AM
shreyash joshi
shreyash joshi - avatar
+ 1
Temp2 refers to an array object that created in the memory: "new Animal[5]" is not null it's a reference of Animal Array in the memory but the indecies of array are null.
31st Mar 2019, 11:25 AM
DarkDeveloper
DarkDeveloper - avatar
0
Yes,i link now.but its giving compilation error in this compiler.
31st Mar 2019, 9:33 AM
shreyash joshi
shreyash joshi - avatar