|
I was interviewed by phone a few days ago.JavaThe parameter transfer method is called by value. The other party corrected the problem. I said, "Pass the value of the basic type, and pass the reference of the object type." Oh, I was aborted, A few seconds later, I realized what he meant and how I met new humans in the new century. But I'm afraid he doesn't understand, let's just define the concept of "Reference" clearly. Do not use the same word or give an example, in the function, assigning values to parameters of the string type does not affect the actual parameters, so he also understands that I actually understand that even after the phone interview
However, it is still not completed. Four rounds of formal interviews: Pen test questions. After the written test, we will talk to leader, manager, and VP, this question exists in every round! I just switched to the form of the SWAp function and asked you to explain the execution results. I am bored. Is this question so big in people's minds? What's the answer from Party?
Bjarne always thinksC ++Education has harmed C ++, so what has harmed the Java language? Excessive commercial publicity!
Of course, commercial promotion successfully helped the Java platform and attracted a large number of developers. However, for the Java language, it is a beginner who first hears the publicity words and then learns again, what I hear is that "Java removes pointers", "Java does not leak memory", and "Java only object-oriented" and other promotional terms accept the superficial phenomenon, without understanding the essence of the problem
Why does Java cancel the pointer? Let's take a look at the exception thrown when the so-called "Reference" is null. Let's see what this is in the eyes of Java Implementers: nullpointerexception! I did not despise Sun, but its details are indeed inferior to MS:. NetThe corresponding exception in is called nullreferenceexception, although it is not changed; as a type of C language, I think the corresponding concepts are still better named, Java is actually all pointer, you basically cannot get the object itself, however, this pointer function is limited and does not need to be deleted.
The pointer concept is disguised and does not need to be deleted. What about other resources except memory? Count yourProgramThe number of finally instances is enough.
Is Java purely object-oriented? In fact, this sentence is understandable, but it uses the "Wrong Guide" defined in <arrow fish action> ", this sentence will make beginners tend to think that all the programs written in Java are object-oriented, which hinders the understanding of the real object-oriented; count the number of switches/If/else in your program based on the object type.
Digress:
I was asked during the interview about the three basic characteristics of object-oriented programming. I know what encapsulation inheritance polymorphism he wants to hear. But in fact, the core feature of traditional object-oriented programming is polymorphism, inheritance is only a means to realize polymorphism, not an essential feature; C language does not inherit, but it can still be programmed in the OO style.
|