Summary of JAVA programmer interview book-let's talk about my understanding

Source: Internet
Author: User
Tags bitwise operators

Summary of JAVA programmer interview book-let's talk about my understanding

September 7, 2014

I started reading this book today and ended the systematic training at the intermediate level of the algorithm in the original plan. I think let's take a look at the interview questions first. Let's drop this book A first.

I have read about half of the books for a day, and I am a little disappointed because the interviews I have explained in this book are the basis of the basics. I am worried about it. It is difficult for the author to go deep into the system to talk about technology, these are all superficial articles.


However, I have sorted out some details for you.

Chapter 5:

-----------------------------------------------------

ClassLoader knowledge.

The overall call usesParent class delegate. Why?Security, avoiding repeated loading.

That is, when classLader is started in JVM,Bootstrap classlader (Class Loader-load), User-defined classloader,

I found a good http://blog.csdn.net/changewang/article/details/6107507.

--------------------

The JVM uses unicode encoding for storage. For external systems, encoding is added to the areas of inputstream and other classes (file read and read boundary) during reading. Windows is GBK encoded.

---------------------

Int j = 0; j = j ++; // j = 0. Cache intermediate variables are similar to temp = jj = j + 1; j = temp;

-----------------

/** Auto increment operator priority **/int I = 0; int y = I ++; System. out. println (y); // 0 + 1 + 2 + 3 = 6 each step + operation, then auto-increment ++, from left to right calculation, not all come out at a time, then, note that I = 0; y = I ++ I; System. out. println (y); // first line ++ I, priority 1 + 2 + 1 = 4


/** The output value is 9.0. Because the value returned by the three-object operation is defined as double, the output value is 10.0 */int x = 5 when x> 5 = false. out. println ("data =" + (x> 5 )? 10.0: 9 ));

/*** The return value of the Three-object operator is a constant. 103 is a constant, not an int !!!, Then g will be specified as a constant output */char g = 'G'; int l = 103; System. out. println (false? L: g); // 103System. out. println (false? 103: g); // g


/** The basic data type is the copy of value transfer * object type, including the string type, is to pass the reference copy * output AB-B * to see the result. */String a = new String ("a"); StringBuffer b1 = new StringBuffer (); stringBuffer b2 = new StringBuffer ("B"); new Test (). operate (b1, b2); System. out. println (b1 + "-" + b2); // b1 = AB b2 = B/** & | use the short-circuit operator, if the first expression can determine the entire expression, the compiler will skip the subsequent expression. * & | ^ Not only bitwise operators, but also Boolean logical operators. Non-Short Circuit operator */int m = 5, n = 5; if (m = 5) | (n ++) = 5); System. out. println ("c. "+ n); // c.5if (m = 5) | (n ++) = 5); System. out. println ("c. "+ n); // c.6/** int Is 4 bytes, 32 bits,> n moves n bits to the right. Each operation moves one or two bits * That Is, sum> 32 moves 32 to the right, with a loop. Still sum = 32 **/int sum = 32; System. out. println (sum> 32); System. out. println (sum> 5); // 5 = 1System. out. println (sum> 6); // 6 ~ 31 = 0/*** remember a Microsoft interview question (x-1) & x question * 1. remove 1. per execution (x-1) & x, you can count the number of 1 * 2.if( x-1) & x to determine if the index is 2 */int t1 = 32; if (t1-1) & t1) = 0) System. out. println ("index of 2"); t1 = 32; // only one 1int cnt = 0 in binary; // count the number of binary 1 while (t1! = 0) {t1 = t1 & (t1-1); cnt ++;} System. out. println ("the number of binary 1 is" + cnt);/** there is also an algorithm commonly used to judge the parity, to quickly scroll the array, thus saving space * (x-1) & amp; 1 odd number = 0 even number = 1 so the result is only 0, 1. There are many examples. As long as you remember (x-1) & 1 can judge the parity, and 0, 1 is the result, future use */

Okay. Sorry, I am sleepy. I will go to rest, and continue tomorrow.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.