Statement
You are welcome to repost, but please keep the original source of the article :)
Blog: http://www.cnblogs.com
Farmer's uncle: http://over140.cnblogs.com
Series
Android Application Development and Improvement series (1) -- Reading Notes of Practical Java Chinese edition (I)
Body
Note: entries and terms may differ from those in books, but try to keep them as they are and add your own understanding
The previous period of time to learn appium, today is ready to appium environment to build the process of writing, so that we can take a few detours. 1. Install the JDK and make the environment variable configuration environment variable configuration: Add Java_home variable, value: JDK installation path, such as: D:\Java\jdk1.7.0_45 add Classpath variable, value.; %java_home%\lib\tools.jar;%java_home%\lib\dt.jar Modify the path variable, plus this s
described in this article.Note: If the message content has a carriage return, it may fail to send. I do not know the carriage return character how to transcode, anyway, how hair is a failure, easy language forum someone in January 15 wrote a solution was adopted, but I follow the Java way to write or send failed, because I do not understand easy language, so maybe I understand wrong.Say something else a little bit more.At present I have seen 2 kinds
final Singleton instance = new Singleton ();p rivate Singleton () {};p ublic static Singleton getinstance () {RE turn instance;}} public class MainClass {public static void main (string[] args) {Singleton S1 = singleton.getinstance (); Singleton s2 = singleton.getinstance (), if (S1 = = s2) {System.out.println ("two instances Same");} else {System.out.println ("Two instances are not the same" );}}}The advantage of using static initialization is thread-safe and does not have to be locked to ensu
singleton.Serialization allows you to write a singleton instance object to disk and then read it back, effectively obtaining an instance. Even if the constructor is private, deserialization can still create a new instance of the class in a special way, equivalent to calling the constructor of the class. The deserialization operation provides a very special hook function, which has a private, instantiated method, Readresolve (), which allows the developer to control the deserialization of the ob
Introduction to Java from getting started to giving up: object-oriented concepts (Entry edition ),
To know what object orientation is, you must first have an object ·
Okay, we are joking. We need to explain what object orientation is.
Example:
"Silly, what did you eat for breakfast today ?"
Silly: "You can eat a lot of food. There are two slices of bread, a chicken pie, a few dishes and leaves, a little s
the traditional blocking IO, and if it does not block, then it is non-blocking IO.
Received the operating system IO model, but also have to mention SELECT/POLL/EPOLL/IOCP, about the four understanding, not much to explain, I have not understood in place.Understandably, after Linux 2.6, the implementation of Java NIO is achieved through Epoll, which can be found through the source code of the JDK. AIO, which is implemented through IOCP on Windows, i
, then all the columns are finished, find a suitable, continue the third Queen, or the first column, the second column ... Until the 8th queen can be placed in a non-conflicting position, we find a correct solution. Then go back to the first queen to put the second column, back to continue the loop ...Okay, start on the code.Package huisu;/** * Created by Wolf on 2016/3/16. */public class Wolfqueen {/** * total number of Queens (at this time set to 8 queens in the 8x8 chessboard, you can modi
. Through the synchronous lock, it realizes the mutually exclusive access to "cruelty". for the production method produce () : When the warehouse is full, the producer thread waits and waits for the consumer to consume the product before the production line can be produced; After the producer thread has finished producing the product, all threads that synchronize the lock are awakened through Notifyall (), including " Consumer thread ", what we call" informing consumers of consumption ". for co
pair. Each time we compare, we copy the larger numbers from the back to the secondary array, making sure the numbers in the auxiliary array are ascending. After copying the larger number to the array, move the corresponding pointer forward one bit, then proceed to the next round of comparisons.After the detailed discussion above, we suspect summed up the process of statistical reverse order: First, the array is separated into sub-arrays, the number of reverse pairs in the sub-array is counted,
Java code to implement:/** * Enter an array of integers with positive and negative numbers in the array. One or more consecutive integers in an array make up a sub-array. * The maximum value of all sub-arrays is evaluated. Requires time complexity O (n) */package swordforoffer;/** * @author Jinshuangqi * * August 8, 2015 */public class E31greatestsumofsubarrays {Pub Lic Integer findgreatestsum (int[] arr) {if (arr.length ==0) return null; int greate
it.Analysis here, we can see that this is actually a very typical recursive thinking, so we write the following Java code:/** * Enter a string to print out all the permutations of the string. * For example, enter the string ABC, print out all the strings that can be arranged by the character A,b,c ABC,ACB,BAC,BCA,CAB,CBA */package swordforoffer;/** * @author Jinshuangqi * * August 7, 2015 */public class E28stringpermutation {public void swap (char[]
pointer is introduced, so we have to deal with the empty list separately. When the first linked list is an empty list, that is, its head node is a null pointer, then it is merged with the second linked list, and the process of the idler merge is the second linked list. Similarly, when the head node of the second linked list is a null pointer, we combine it with the first linked list to get the first linked list. If two linked lists are empty lists, the result of merging is to get an empty list.
numbers are pressed into the stack and the next number is not found, then the sequence cannot be a pop-up sequence.After the formation of clear ideas, we can have some code, the following is the implementation of Java code./** * Enter a sequence of two integers, the first sequence represents the stack's indentation order, and determine if the second sequence is the pop-up order for the stack. */package swordforoffer;import java.util.stack;/** * @auth
people met in the number 2, the benchmark number 3 and this 2 exchange, get a new array 2 1 0 3 7 9 3 5, the 3 as a split point, the entire array is divided into two parts, the left 2 1 0 and the right 7 9 3 Repeat the above steps to continue sortingThe Java code is as follows: Public classQuickSort { Public Static voidMain (string[] args) {//TODO auto-generated Method StubQuickSort QS=NewQuickSort (); int[] score = {10,9,8,7,6,5,4,3,2,1}; Qs.quickso
[] Bubblesortresult =px. Bubblesort (score); for(inti=0;i) {System.out.print (Bubblesortresult[i]+" "); } } /** Bubble sort * @param score score (0-10 points) * @return return count array * Description: There are n number, two adjacent number comparison, if the previous number is smaller than the number of the subsequent exchange position, assuming that a minimum number is placed in the most Back to a trip, you need to compare 1~n-1, set the number of times I, each trip compared to 1~n
Sword refers to Offer interview question 27 (Java edition): Binary Search Tree and two-way linked list, sword refers to offer
Question: enter a binary search tree and convert it into a sorted two-way linked list. It is required that a new node cannot be created. You can only adjust the point of the node pointer in the tree.
For example, in the binary search tree, the two-way linked list after the output con
of the list is the 1th node in the bottom. * For example, a list of 6 nodes. Starting from the beginning, their values are sequentially 1. 2. 3,4,5. 6. The 3rd node of the list is the node with a value of 4 */package swordforoffer;import utils. listnode;/** * @author Jinshuangqi * * August 1, 2015 */public class E15kthnodefromend {public ListNode findkthtotail (listnode Head,int k) {if (head = = NULL | | k Test example; function tests (the K-node is in the middle of the list, and the K-node is
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.