in Technology by

What happens when we invoke a method on a nil pointer?

1 Answer

0 votes
by

A message sent to a nil object is perfectly acceptable in Objective-C, it’s treated as a no-op. There is no way to flag it as an error because it’s not an error, in fact it can be a very useful feature of the language. It returns 0, nil, a structure filled with 0s, etc.

Related questions

0 votes
    Which of these exceptions handles the situations when an illegal argument is used to invoke a method? (a) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    How can we put nil it into dictionary/array?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    What happens when we use mean field approximation with boltzman learning? (a) it slows down (b) it get speeded up ... ) may speedup or speed down Please answer the above question....
asked Aug 27, 2022 in Education by JackTerrance
0 votes
    What happens when we access the same variable defined in two interfaces implemented by the same class? (a) ... Packages of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    When will the browser invoke the handler? (a) Program begins (b) Any event occurs (c) Specified ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    what happens when you click on the following in costume tab:edit button, copy button, x button Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    what happens when you click on the following in costume tab:edit button, copy button, x button Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    what happens when you click on the following in costume tab:edit button, copy button, x button Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    How can we do Pointer comparison in C?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    Can we have a volatile pointer?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    What is a normalized pointer, how do we normalize a pointer?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    Can we have a volatile pointer?...
asked Jan 23, 2021 by JackTerrance
0 votes
    What happens if we put a key object in a HashMap which exists? (a) The new object replaces the ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
...