[Java concurrent programming practice] -- "J. U. C": Condition, j. u. ccondition
Before reading Condition, let's take a look at the following example:
Factory type, used to store and retrieve goods:
Public class Depot {private int depotSize; // repository size private Lock lock; // exclusive lock public Depot () {depotSize = 0; Lock = new ReentrantLock ();} /*** warehouse receiving ** @ param value */public
in the use of this tool can be a smooth transition, and nginx this software, for the vast number of developers just meet these two requirements, without heart, users will appreciate, intentions, is to let users do not understand, inseparable from! Isn't that the thinking of Internet products?
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the Java cluster optimization-
the target character array.4, String.Replace () replaces the element or substring in the original string. Returns the replaced string.5. String.touppercase () capitalizes the characters in string strings.6, String.tolowercase () to lowercase characters in string strings.7, String.Trim () remove the string header space.8, String.tochararray () converts a string to a character array.Four, string encryption.First, design ideas:Define the class, the dialog reads into string s1, defines a char array
"). ReplaceAll ("W", "X"). ReplaceAll ("x", "Y"). ReplaceAll ("Y", "Z"). ReplaceAll ("Z", "A")) ;
3. Randomly generate 4-bit verification code, the user input and verify that the input is correct, if the input error to generate a new verification code to allow users to re-enter, up to 5 timesString str= "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";Char[]arr=new char[4];//defines an array of type char with a length of 4Random sj=new random ();System.out.println ("Verific
: Console input age, according to age output different tipsScanner sc=new Scanner (system.in);System.out.println ("Please enter an Age:");int Age=sc.nextint ();if (age>60){System.out.println ("You are old");}else if (age>30){System.out.println ("You are middle-aged");}else if (age>18){System.out.println ("You for Youth");}else if (age>13){System.out.println ("You are a teenager");}Else{System.out.println ("You Are Children");}
Topic Seven: Enter the radius of the circle, calculate and outp
1 PackageCom.hanqi;2 3 Public classLadder {4 5 DoubleShangdi;6 DoubleXiadi;7 DoubleGao;8 DoubleMianji;9 TenLadder (DoubleShangdi,DoubleXiadi,DoubleGao) One { A //using parameters to initialize properties - //This represents the current class - This. Shangdi =Shangdi; the This. Xiadi =Xiadi; - This. Gao =Gao; - - } + //method naming: verb + name; verb First letter lowercase - //void means no return value +
Write 2 interfaces:interfacea and interfaceb; in interface interfacea There is a method void in the Printcapitalletter (); there is a method in interface interfaceb void printlowercaseletter () ; thenWrite a class print Implementation interface Interfacea and interfaceb, require print Capitalletter () methodImplements the output uppercase English alphabet function, theprintlowercaseletter () method implements the output lowercase EnglishThe function of the alphabet. Write a main class e, creat
Java practice of 04JavaWeb-03 session technology, java04javaweb-03I. Introduction to session Technology 1. What is session? Why is session technology required?
Session: the process from opening a browser, accessing a website, to closing the browser is called a session. The http protocol is in the status.2. Classification of session Technology
Client Storage Technology: Cookie
Server storage technology: Sess
/***┏┓┏┓*┏┛┻━━━┛┻┓*┃┃*┃━┃*┃> */ Public classTest { Public Static voidMain (string[] args) {person P1=NewChinese (); Person P2=NewAmerican (); P1.say (); P2.say (); }}/*Output: Hi Hello*/ Public Abstract class Person { abstractvoid Say ();} Public class extends Person { publicvoid say () { System.out.println ("Hello");} } Public class extends Person { publicvoid say () { System.out.println ("Hello");} }A sayable interface can also be implemented.The seco
auto-generated method stub//Check Find XML, first create Documentbuilderfactory instance documentbuilderfactory factory = Documentbuilderfactory.newinstance ();// Create an Documentbuilder instance by documentbuilderfactory instance Documentbuilder Builder = Factory.newdocumentbuilder ();// The parse method is called through the instance of Documentbuilder to read the XML file document doc = Builder.parse ("Src/loclist.xml"); test04 (DOC);} 1. Traverse all nodes public static void tes
Recently in the study of the Java reflection mechanism, watching online video, and copied down the study, using the Servlet annotations, no less than the use of SPRINGMVC annotations, hereby record sharing, Servlet no longer need to pass parameters to determine the worry, focus on the business!1. First define a parent class, all of which are inherited by all business operations.1 PackageController;2 3 Importjava.io.IOException;4 ImportJava.lang.refle
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.