java practice exam

Alibabacloud.com offers a wide variety of articles about java practice exam, easily find your java practice exam information here online.

[Java concurrent programming practice] -- "J. U. C": Condition, j. u. ccondition

[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

Java Cluster optimization--nginx+tomcat cluster configuration-Practice Chapter

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-

Java Classroom Practice--string

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

java-String Practice

"). 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

java-Conditional statement, loop statement practice

: 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

Java Exception Practice

"); /* No abnormalities, the teacher's normal class * *}}Class Lanpingexception extends Exception/* Custom blue screen Exception */{Lanpingexception (String m){Super (M);}}Class Maoyanexception extends Exception/* Custom Computer Smoke Exception */{Maoyanexception (String m){Super (M);}}Class Noplanexception extends Exception/* Custom teacher Handling Exception */{Noplanexception (String m){Super (M);}}Class computer{private int state=3; /* Different exception State selection */public void Run (

Java Practice-Scrolling text

  Java Practice-Scrolling text

Learn to practice Java Object-oriented trapezoid area

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 +

Learn to Practice Java writing a journey to the character class

1 PackageCom.hanqi;2 3 Public classXiyoujirenwu {4 5 Doubleheight;6 7 String weapon;8 9 String name;Ten One voidPrinetname () A { - System.out.println (name); - } the - voidPrinetweapon () - { -System.out.println ("Weapon" +weapon); + } - + Public Static voidMain (string[] args) A { atXiyoujirenwu SW =NewXiyoujirenwu (); -Sw.name= ("Monkey King")); -Sw.weapon= ("Ruyi Golden Cudgel"); -System.out.println (sw.name+ "using" +sw.weapon);

Learn to practice Java Object-oriented deposit and withdrawal enquiry balance

1 PackageCom.hanqi;2 3 Public classAccount {4 5 String Zhanghao;6 7 DoubleCunkuanyue;8 9Account (String Zhanghao,DoubleCunkuanyue)Ten { One //Initialize A This. Zhanghao =Zhanghao; - This. Cunkuanyue =Cunkuanyue; - } the - //Deposit - //a method with no return value with parameters - voidCunkuan (DoubleQianshu) + { -System.out.println ("Saved" +Qianshu); + This. Cunkuanyue + =Qianshu; A } at - //Withdrawal

Java Exception Practice

Doublebalance; PublicBank (Doublebalance) { Super(); This. Balance =balance; } Public DoubleGetBalance () {returnbalance; } Public voidSetbalance (Doublebalance) { This. Balance =balance; } DoubleWithDrawal (DoubleDamount)throwsException {if(damount>balance) { Throw Newinsufficientfundsexception (); } if(damount) { Throw Newnagativefundsexception (); } return This. Balance; } Public Static voidMain (string[] args) {Bank

Java Cycle Practice: The problem of hundred chickens

chickens: 78 Cocks: 13 only Hens: 4 only chicks: 69 Cocks: 13 Hens: 5 Chick: 60 cocks: 13 Hens: 6 Chicks:51 Cocks: 13 Hens: 7 Chickens: 42 Cocks: 13 Hens: 8 only chickens: 33 Cocks: 13 only Hens: 9 only chicks: 24 Cocks: 13 Only Hens: 10 Chick: 15 Cocks: 13 Only hens: 11 Chicks: 6 Cocks: 14 only hens: 1 Chicks: 81 Cocks: 14 only hens: 2 Chicks: 72 Cocks: 14 Hen: 3 chickens: 63 Cocks: 14 only hens: 4 Chickens: 54 Cocks: 14 Only hens: 5 Chicks: 45 Cocks: 14 Hens: 6 Ch

Java Basic Knowledge Network programming (TCP practice)

)). Start (); } }} class userloginthread implements Runnable{ PrivateSocket s; Userloginthread (Socket s) { This. s=s; } Public voidRun () {Try{BufferedReader burin=NewBufferedReader (NewInputStreamReader (S.getinputstream ())); for(intI=0;i3; i++) {String user=burin.readline (); System.out.println ("username sent to:"+user);if(user==NULL) {System.out.println ("is empty"+user); Break; } BufferedReader bur=NewBufferedReader (NewFileReader ("User.txt")); String line=NULL;Booleanflag=false; w

Java Basic Practice Writing 2 interfaces

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-03

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

The second season of Java, chapter fifth, stage practice

/***┏┓┏┓*┏┛┻━━━┛┻┓*┃┃*┃━┃*┃> */ 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

Basic practice of XML and DTD for Java EE

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

multithreaded Practice (Java)

] =mid; + } A } at } - for(inti=0; i) - { - System.out.println (Thread1[i]); - } -System.out.println ("Thread1 printing completed. "); in } -}1 Importjava.util.Arrays; 2 3 Public classThread2ImplementsRunnable {4 5 Private intthread2[]; 6 Thread2 (randomnumber rn)7 { 8 //Thread2 = new Int[rn.num.length]; 9Thread2 =Rn.num; Ten } One A Public voidRun () - { - Arrays.sort (Thread

Java Basics Enhanced IO flow Note 50:io Stream practice copy multi-level folder cases

);Wuyi } the } - Private Static voidCopyFile (file srcfile, file newFile)throwsIOException { WuBufferedinputstream bis =NewBufferedinputstream (NewFileInputStream ( - srcfile)); AboutBufferedoutputstream BOS =NewBufferedoutputstream ( $ NewFileOutputStream (NewFile)); - byte[] Bys =New byte[1024]; - intLen = 0; - while(len = Bis.read (bys))! =-1) { ABos.write (bys, 0, Len); + } the bos.close (); - bis.close (); $ } the}

Java Reflection Mechanism Demo practice

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

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.