This article mainly introduces the use of Java InputStream flow.
(1) FileInputStream: Subclass, read the data channel
Use steps:
1. Get target file: New file ()
2. Establish channel: New Fileinputstring ()
3. Read data: Read ()
4. Release
The Java.util.concurrent package provides classes on multithreaded operations, often using more executorservice and their implementation classes (such as Threadpoolexecutor), Executor,executors, Future,callable, etc.
1. Executorservice (inherited
Java thread Pool Executorservice
1. Thread pool
1.1 What happens when you use the thread pool
A single task has a relatively short time to process.
The number of tasks that will need to be handled is large.
1.2 Benefits of using a
The difference between the Start method and the Run method in a thread
In the thread, if the Start method calls the Run method in turn, why do we choose to invoke the Start method? Or what is the difference between calling the Start method and the
First look at the example
The code is as follows
Copy Code code as follows:
Classip
{
Privatestaticlongiptolong (Stringstrip)
Converts an IP address in the form 127.0.0.1 to a 10-binary integer, without any error handling
{
intj=0;
First, the synchronization problem proposed
Thread synchronization is the destruction of data that prevents multiple threads from accessing a data object.
For example: Two threads Threada, threadb both manipulate the same object Foo object and
1. String class
The value of string is immutable, which causes a new string object to be generated every time a string is created, not only inefficient, but also a waste of limited memory space.
String a = "a"; Suppose a points to address 0x0001
A =
Topic: Defines the left rotation of a string: moves several characters in front of the string to the end of the string. If the string abcdef left rotate 2 bits to get the string cdefab. Implement the function of the left rotation of the string.
Using Dockerfile to build a Java compilation environment, here is the implementation step:
1, including the following software packages
Ubuntu
Jdk
Maven
Svn
2, JDK, maven need to manually download, after downloading for
Jdk-8u5
Javax.servlet.http.HttpServlet is not found:
The recent project to discover this javax.servlet.http.HttpServlet is not found error problem, after the Internet query to solve, here recorded, may be able to help needy friends.
1. The errors we have
The generation and principle of random numbers in Java
Consult random number related data, special to do sorting
First, let's talk about several ways to generate random numbers in Java
In J2SE we can use the Math.random () method to produce
In the current Web project, there are many situations where the same account information can be logged in at different login entries this time, this is not so good.
Recommended reading:
Implementation method of Java multiuser login limit
There
The free blocks in Java are divided into static free blocks and non-static free blocks.
The execution time of a non-static free block is: Before the constructor is executed.
The execution time of the static free block is: The class file
This is a Microsoft Classic pen test, is two pointers h1,h2 start from the beginning to traverse the single linked list, H1 each step forward 1 steps, H2 each step forward 2 steps, if the H2 encountered null, indicating that the ring does not exist,
Historically, Java has tried to provide a preemptive limit interrupt, but there are many problems, such as the discarded thread.stop, Thread.Suspend, and Thread.Resume described in the previous article. On the other hand, due to the robustness of
Interrupt method
Interrupt is literally meant to be interrupted, but in Java the Thread.Interrupt () method actually notifies the thread in some way and does not abort the thread directly. What you do is determined by the person who writes the code,
Differences and connections between servlet, filter, Listener, Interceptor
First, the concept
1.servlet:servlet is a server-side Java application that has platform-and protocol-independent features and can dynamically generate Web pages that work
blocking queues in Java
1. What is a blocking queue?
A blocking queue (Blockingqueue) is a queue that supports two additional operations. The two additional actions are:
When the queue is empty, the thread that gets the element waits for the
Loading a resource file is more commonly used in two ways:
First, with ClassLoader, said here will have to mention the classification of ClassLoader, Java built-in ClassLoader mainly have three kinds,
The first is the root class loader (bootstrap
1, Java code:
The main use of DOM to operate
Copy Code code as follows:
Package test;
Import java.io.IOException;
Import Javax.xml.parsers.DocumentBuilder;
Import Javax.xml.parsers.DocumentBuilderFactory;
Import
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