Original: Taste of Little Sister (wechat official ID: XjjDog), welcome to share, please reserve the source.
China GengChen month, strong winds, sand and stones flying. Like a knife hidden in the wind, cut off the top of my hat.
Today I’m waiting for the interview I haven’t had in a long time. I was under the impression that the interview was face-to-face. I’ve been through so many video and phone interviews in the past few weeks because of the pandemic that it’s always chilling. The thought of a prim interviewer hiding his lower half under the covers or squatting on the toilet made me cringe.
It was mostly because I was frustrated that I couldn’t show myself. So take the chance today and I’m going to put in a good performance.
The car sped halfway around the city. Check out and pay in one go. I looked down at the map, covering the screen with my hand. Heart said: to brother, accept my ravages.
I squeezed into the elevator with my pocket and accidentally bumped into the girl next to me. She leans over in disgust and angrily swipes at the screen of her phone. In order to be in a good mood before the interview, I automatically ignored it.
I’m XjjDog. Nothing else. Great code. Working on JAVA for 10 years, the pieces are all the key parts. Many times, there are 40 or 50 people, call meDirector of cattle
.
After introducing myself, the interviewer sitting across from me looked calm and expressionless. But I knew he must be trembling inside, searching for questions to put me down.
That’s not what I’m used to. It is strong, the wind blows the hills. The moon shines on the river.
While I was in a daze, he swiped down a piece of code on the whiteboard and asked me to analyze the final result.
My eyes widened and I saw this thing on the whiteboard. The space also considerate to mark out to me.
int a = 2;
int b = a++ << ++a + ++a;
System.out.println(b);
Copy the code
It makes my head swell. It’s this kind of unparenthesized code that scares me the most, and it usually takes me back to my miserable school days.
You should expand the main calculation logic in parentheses, the code is almost unreadable. I suggested.
He looked at me without a word, swiped and added a few parentheses. I stared and broke out in a cold sweat.
int a = 2;
int b = (a++) << (++a) + (++a);
System.out.println(b);
Copy the code
I thought you were fooling me. There’s no difference between parentheses and no parentheses. I tried to deduce the process, and the more I analyzed it, the more I became alarmed.
The interviewer saw my embarrassment and gave me a long-lost smile.
I can tell you the result directly, it’s an integer, his voice seems to be coming from far away, it’s 1024, and you can analyze the execution based on the result.
Dear students, you might as well do a reverse analysis. This question is so tricky that even my current calm analysis will take a long time. In the tense situation, with the interviewer staring at you, my mind was in a fog. But my ego doesn’t give in, so I try to push it backwards from a different Angle.
And I thought. 1024 is two to the tenth, but no matter how you analyze it, you don’t get this result. After a brief thought, I threw in the towel.
We usually do not write such code, after a period of silence, I had to take out a trump card, when our code review, will try to avoid such ambiguous code writing, which is also the focus of our governance.
The interviewer smiled more broadly, showing his even white teeth. He was very satisfied with my answer.
I expected him to talk about more advanced topics, such as distribution, transactions, and architectural ideas. And he kept talking to me about how to do it. For example, the underlying structure of the old HashMap, the hash algorithm of String, what 31 means, and when a red-black tree is used.
I told him that 31 was the result of the probability statistics after the test, and that it was also a more suitable prime number. As for red-black trees, it doesn’t really help us to understand and solve the problem, because JDK8 used to use arrays and linked lists. How can JDK8 be like the Bible when it is released?
After so much bland talk, I felt as if I had collapsed.
The other person seems to be particularly interested in rote memorization of obscure knowledge, or knowledge that is true in old versions of Java but disproved in new ones. As time goes by, the smile on the interviewer’s face becomes more beautiful. It was as if he had become a man-eating tiger and opened his mouth wide.
- What are the PECS principles of Java?
- Why does Java8’s ConcurrentHashMap abandon segmentlock? How is it done?
- Can you handpick an accurate binary search algorithm? (On paper, no computer)
- What is the dye pointer for ZGC?
- .
The interviewer is very knowledgeable about these things, and I might have been fooled if I hadn’t been reading xJJDog articles.
You’ve used design patterns. Java singleton, double check, can you analyze it?
Hearing this, I could no longer contain the anger in my heart.
Double-checking, already an anti-pattern,sonar
There are even rules for analysis. We should try to avoid writing code like this, so what’s the point of analyzing it?
** How do you know it’s an anti-pattern if you don’t analyze it? ** The interviewer was relentless.
I think we both need to calm down. At the same time, I recognize the deep gulf between the two sides.
I don’t quite understand the question. Can you give me some information about it? I finally gave up.
He looked at me blankly for a few seconds, probably not expecting me to have such a problem.
I’ve never been able to stand awkward silences. I covered the stomach, said: stomach a little uncomfortable, I can go to the toilet first?
He nodded, almost instantaneously.
On my way through the noisy office to the bathroom, I saw a young girl on the elevator, listening respectfully to a bald man next to me growling at her.
Ah, these young people, never have the sentiment of pity.
Oh, I am. Find the toilet, undress, open the gate water in one go, feel very comfortable.
The elevator is right next to the toilet, which goes against feng shui.
I sidled in after a few employees rushed to work. From the opening of the elevator slowly closing, reflected the fact that I urinated.
Xjjdog is a public account that doesn’t allow programmers to get sidetracked. Focus on infrastructure and Linux. Ten years architecture, ten billion daily flow, and you discuss the world of high concurrency, give you a different taste. My personal wechat xjjdog0, welcome to add friends, further communication.