example, suppose to be a ticket-selling system, where multiple threads (2 threads in an example) manipulate the same variable Ticketcount (number of remaining votes).
Expected: Multiple threads synchronize to the same variable without causing
How to read a sound file in 1,java:
String wavename = "Voice.wav"; try {inputstream ws = GamePanel.class.getResourceAsStream (wavename); Audiostream as = new Audiostream (WS); AudioPlayer.player.start (AS); catch (Exception e) {System.out.println
1, the choice of sorting method
public class Selectionsort {public
static void Main (string[] args) {
double[] numbers={3,2,5,4,6,8,1,7,9,0};//Call Selectionsort Select the Sort method
Selectionsort (numbers);
for (int i=0;i=1;i--)
Import java.net.*;
Import java.io.*;
Import java.util.*;
public class readurlfile{public
static void Main (string[] args) throws exception{
url urlfile = new URL ("HTTP://1 92.168.16.34/xuys/index_.html ");
BufferedReader in = new
Find the prime number within 100:
public void A () {for
(int i = 2; I = temp) {
System.out.println (i + "is a Prime");}}}}
(b) To find the prime number between n-m
public void Sushu (
In the Java language, when using recursive calls, if too many calls are easily caused
Java.lang.StackOverflowError is stack Overflow and program execution is too slow。 This is a potential bug and affects program execution efficiency issues that need
1) Check the installation of JAVA&JDK in the current environment
$ rpm-qa|grep JDK $ rpm-qa|grep java
2 to unload all the items in the list resulting from the execution of the above 2 commands
$ rpm-e--nodeps xxx (XXX is the list item after the
/** * * @author Fly/public class Insertsort {public int[] Insertsort (int[] a) {int size = A.length;
Int J;
for (int i = 1; i J; k--) {a[k] = a[k-1];
} A[j] = temp;
return A;
Public int[] InsertSort1 (int[] a)
public static void Main (string[] args) {
list List = null;
for (Object s:list) {
System.out.println ("a");
}
}Exception in thread "main" java.lang.NullPointerException
At Com.joyplus.util.Tets06.main (tets06.java:14)
This test
Apache camel--A Enterprise integration patterns, reference to Enterprise Integration mode: Designing, building, and deploying messaging solutions.
Provides message routing route: The basic function is to accept messages, process messages, and assign
1, http://java.sun.com/
English
Sun's Java Web site is a place that should be seen often. Don't say much.
2, http://www-900.ibm.com/developerWorks/cn/
IBM's Developerworks website, English good direct to the English main site to see. Here is not
Package utils.sort;
/**
* Insert sort, require array to be sorted must implement comparable interface
*/
public class Insertsort implements Sortstrategy
{
/**
* Sorting obj using the Insert sort algorithm
*/
public void sort (comparable []obj)
{
if
Package utils.sort;
/**
* Merge sort, require array to be sorted must implement comparable interface
*/
public class MergeSort implements Sortstrategy
{
Private comparable[] Bridge;
/**
* Using the merge sort algorithm to sort the array
Synchronizing access to shared variable data
The meaning of synchronization has two aspects, previously thought only for the operation of the mutual exclusion, to maintain a consistent state, understanding too shallow, need in-depth study.
One,
One, virtual machine stack (stack memory)
1, storage of basic types of variable data , such as:
int a = 10; 10 is stored in the corresponding stack memory
2, deposit reference variables , such as:
ClassA a = new ClassA (); A is referencing variables,
Read and write properties files, each time written in Chinese, the text editor to open the Chinese display is binary characters.
Inputstream/outputstream only deals with 2 of binary data, Inputstreamreader/outputstreamwriter contains processing
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