Read the importance of source code: for example, the chef selects food ingredients and plays kitchen utensils-how to view the Java and Android source code in Eclipse, eclipseandroid
First of all, many people say that they will not learn Java without looking at the source code in jdk. Obviously, this is positive. For example
Java serialization Serializable (detailed example)
1. What is serialization and deserialization?Serialization is a process of describing objects in a series of bytes. deserialization is a process of recreating these bytes into an object.
2. Under what circumstances should serialization be performed?A) when you want to save the objects in the memory to a file or database;B) when you want to use a socket to
Java compressed file tool class ZipUtil usage code example, tool class ziputil
This example uses the Java Zip input/output stream to compress and decompress files. The first part of the code is used to obtain the file path and change the compressed file name. The details are as follows:
Package com.utility.zip; import
After finding a Java Socket Image Transmission example on the Internet for a long time, you can directly use
It will be useful in the future.
Server:
Java code:
Import java. Io. bufferedinputstream;Import java. Io. datainputstream;Import
In this example, FileChannel and BufferedInputStream are used for test and comparison.
TestHandler. java is used to implement dynamic proxy and test the running efficiency.
Package com. test; import java. lang. reflect. invocationHandler; import java. lang. reflect. method; import
. util. stringtokenizer # hasmoretokens () * @ see Java. util. stringtokenizer # nexttoken (string) */Public void Test2 () {This. printseparater ("Test2"); stringtokenizer tokenizer = new stringtokenizer (source1); While (tokenizer. hasmoretokens () {system. out. println (tokenizer. nexttoken (delim1 ));}}
/*** A comprehensive example that splits a sentence and splits each word. In this
Transferred from: http://blog.chinaunix.net/uid-20180960-id-1972669.htmlLinux platform Java call so library-jni use example 2010-08-11 22:171. Ensure that the GCC compiler is installed2. Write the Hellojni.java code and declare the functions that need to be implemented in C with native.If the source program is included in the package, the same folder structure should be created, such as/home/swan/test/net/w
RMI is the specification for remote calls on the Java platform. The following is a small example.
There are three Java classes, remote interfaces, server programs, and client programs.
Remote interface:
Import java. RMI .*;
Public interface helloin extends java. RMI. Remote
From: http://blog.csdn.net/ladofwind/archive/2005/01/11/248820.aspx
RMI is the specification for remote calls on the Java platform. The following is a small example.
There are three Java classes, remote interfaces, ServerProgram, Client program
Remote interface:
Import java. RMI .*;
Public interface helloin
each update, it is necessary to download and update resources over the network and automatically update the system.How to implement:
Below is a simple example of JAVA Implementation for delayed download of resources. Load the two sample programs in my previous blog and run one of them. (PS: Since the resources loaded in this example are jar, dynamic class loadin
interface is a manufacturer (marker) interface. That is, the interface does not need to implement any methods for the class to implement it. It is used primarily to inform the Java Virtual Machine (JVM) of the need to serialize an object.
For this, there are several points we need to be clear:
Not all classes can be serialized, under CMD, we enter Serialver Java.net.Socket, we can get the information that the socket is serializable, actually the s
thinking from Java single example and single case
Objective
A few days ago accidentally saw an article, talked about the cliché of a single example, holding a review of the mentality points in, or those familiar with the content, but found himself thinking of the angle changed, before more is to remember, only stay on the surface, and now more is to think why
converted to a running state: When this thread gets the processor resources;
The run state is converted to a ready state: When this thread actively invokes the yield () method or loses the processor resources during the run process.
The run state is converted to a dead state: When this thread thread execution completes or an exception occurs.
It is important to note here that when the yield () method of the thread is invoked, the thread transitions from the run state to the ready state, but
Step 1: Go to https://jogl.dev.java.net/download jogl-1.1.2-pre-20080523-windows-i586.zipDecompress to a random folder, such as: C:/program files/Java/jogl-1.1.2-pre-20080523-windows-i586Open eclipse, and click File --> New ---> Project ---> project name, for example, my_opengl ---- finish.After creating a project, find the new project in the workspace on the left.
For
/*
* Simple example of reading/writing text files
* There are three examples:
* 1. Example of reading a file into memory (stringbuffer here)
* 2. Write the text in the content to a file
* 3. Read the content of one file and write it to another file.
* It also shows that if the content read from the input stream is written to the output stream (Text Stream only)
* The three examples can exist independently,
of multiple threads in a multi-CPU environment for changes in shared variable values
Visibility issues are caused by the CPU cache
If multiple variables need to address the visibility issue, not all variables need to be declared volatile. Visibility can also be guaranteed in the following situations:
Declare only one variable to be volatile, and then read the first to read the volatile variable, and write the last to write the volatile variable.English website:Http://tutorials.jenk
. @ SuppressWarnings indicates that some improper compiler warning information is disabled. The following is an example of [java] package com. annotation. test; import java. lang. annotation. documented; import java. lang. annotation. elementType; import java. lang. annotati
1. java reads text files to the mysql database [Example]: reads the phonenumber table of the database school from the mobile phone number home location file: mongotong .txt.The contents of the 2XX wildcard are as follows:[Plain]13003000000-13003009999-Hefei130030316-13003029999-Bengbu13003030000-13003049999-Wuhu13003050000-13003069999-Hefei13003070000-13003079999-Huainan13003080000-13003089999-Hefei13003090
This article mainly introduces the example code for Java to generate and parse XML files and strings. For more information, see section 1. basic knowledge:
Java parses XML in four ways: DOM, SAX, JDOM, and DOM4J.
2. Introduction1) DOM(1) Introduction
The interface provided by W3C (org. w3c. dom) reads the entire XML file into the memory and constructs a DOM tree
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.