java practice exam

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

Blue Bridge Net question Java basic Practice Rectangle area Intersection

-------------------------------------------------------------------------------------------Ideas See the Jin SAC 2-------------------------------------------------------------------------------------------Algorithm1 ImportJava.util.Scanner;2 Public classMain {3 Public Static voidMain (string[] args) {4Scanner sc =NewScanner (system.in);5 Double[] x =New Double[4];6 Double[] y =New Double[4];7 Double[] Z =New Double[4];8 for(inti=0;i){9X[i] =sc.nextdouble ()

Algorithm note _076: Blue Bridge Cup practice node selection (Java)

node of first start node for(inti = 0;child! = 0;i++) { child=tree[start][i]; if(child! = Root) {//prevent the child from start from becoming the father of startDFS (child, start); dp[start][1] + = dp[child][0];//start backtracking when the child node does not have a children nodedp[start][0] + = (dp[child][1] > dp[child][0]? dp[child][1]: dp[child][0]); } } } public Static voidmain (string[] Args) {main test=NewMain (); Scanner in=NewScanner (system.in); intn =In.next

Getting Started with Java: User Login and Registration Module 1 (Practice project)--analysis

login authentication method, the parameter is the user object (which can also be a username and password), is verified by returning true, otherwise false is returned.Logout (String name): Resets the specified user (username name) from the logon state to a non-logon state. The task of this project simple processing, direct output "log out" a line of information can be.Register (user usr): Writes the incoming new user usr to the data file. Returns true to indicate an increase in success and false

Java annotation practice

@ Interface indicates that this is an annotation type @ Retention three policies are provided Retentionpolicy. runtime: not only in the source code stage, but also in the JVM where the annotation confidence is added during the runtime. Retentionpolicy. Class: in the source code stage, the annotation information is saved during the compilation stage. Annotation @ retention default value. Retentionpolicy. Source: saves annotation information in the source code stage. @ Target indicates wh

Atitit File Upload Architecture Design Implementation Mechanism Solution Practice Java PHP c#.net js javascript c + + python

Atitit File Upload Architecture Design Implementation Mechanism Solution Practice Java PHP c#.net js javascript c + + python

Java Web practice topic-image management

A large number of images may exist in a website. Some images are the same for all webpages, such as the logo of a webpage and images on the home page. These images are like common HTML files, the processing of these images is usually done by the Web editing tool, that is, it is usually done by the artist. The following HTML Tag is used: SRC specifies the file path and uses the relative path, generally, we create a folder named images in the Web application to store all the images. Generally, th

Java Concurrency Programming Practice Note-happens-before rules

. If operation A is performed before action B and action B is performed before Operation C, then operation a must be performed before Operation C.The following is an English description of happens-before,the Happens-before relation defines when data races take place. An unlock in a monitor happens-before every subsequent lock on the that monitor. A write to a volatile field happens-before every subsequent read of the that field. A call to start () on a thre

Combination of objects in Java concurrency programming practice

Ownership of the stateThe object encapsulates its state, owning the state ownership, which is the ability to change the state, and if the object's reference is published, it is not the ownership of the object's exclusive state, but the ownership of the shared state with the other;2. Instance closure  Object A is enclosed in another object B, and the path to access object A is known to facilitate thread safety, and if the data is enclosed in an object, access to the data is done through methods,

"Java from getting started to giving up" javase introductory article: Practice-Single Dog rental system

; 650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/07/05/wKiom1nCJVnwvUEWAAAhG4LOApM274.png "style=" float : none; "title=" 16.png "alt=" Wkiom1ncjvnwvuewaaahg4loapm274.png "/> 650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/A5/B6/wKioL1nCJSWAkSvkAAAMaSguaw8190.png "style=" float : none; "title=" 17.png "alt=" Wkiol1ncjswaksvkaaamasguaw8190.png "/> 650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/07/05/wKiom1nCJVnxekLhAAAQzRb53-Y170.png "style=

Blue Bridge Cup: Basic practice decimal Turn Hex "Java algorithm implementation"

Title DescriptionA nonnegative integer is given, which is represented as a 16-binary form.Input formatThe input contains a non-negative integer A that represents the number to convert. 0Output formatOutput 16 binary representation of this integerThe problem with the real output if not specifically stated, rounding is done by rounding.Sample input30Sample output1EImport Java.util.scanner;public class Main {public static void main (string[] args) {Scanner cin = new Scanner (system.in); I NT n = ci

Java Practice (iv)--decomposition factorization

Title: Decompose a positive integer into factorization. For example: Enter 90 and print out 90=2*3*3*5.Program Analysis: The decomposition of n factorization, should first find a minimum prime number k, and then the following steps to complete:(1) If the prime number is exactly equal to N, then the process of decomposing the factorization is finished and printed out.(2) if n(3) If n cannot be divisible by K, the first step is repeated with k+1 as the value of K. Public classTest1 { Public voidZh

Java object-oriented practice---Bank business Simulation (array + object-oriented)

enter the country:"); String country = Sc.next (); System.out.print ("\ n Please enter province:"); String province = Sc.next (); System.out.print ("\ n Please enter street:"); String Street = Sc.next (); System.out.print ("\ n Please enter house number:"); String id = sc.next (); System.out.print ("\ n Please enter your account's initial balance:"); Double money = sc.nextdouble (); Address address = new Address(country,province,street,id); User user = new User(code,name

Java Practice---10

1 PackageCn.zrjh;2 3 Public classL {4 5 Public intID;6 PublicString name;7 Public intAge ;8 PublicString City;9 PublicString introduce () {Ten return+ ID + ": under" + Name + ", Christina" + Age + ", lives" +City ; One } A - -}1 PackageCn.zrjh;2 3 Public classY {4 5 Public Static voidMain (string[] args) {6L p1=NewL ();7L p2=NewL ();8L p3=NewL ();9L p4=NewL ();Tenp1.id=100000; P1.name= "Lo Yuanhao"; p1.age=19;

Java error page Practice

If a page does not handle the exception, then the page will be displayed, obviously the user does not want to see this page, then we can jump to a friendly page. IE clever can change other browsers to see the effect. index.jsp errorpage.jsp Java error page Practice

In the Java language: ++a and a++ small exercises & and && small exercises | with | | Little practice Boolean type little exercise

---------------------------------------------------First questionint x = 1,y = 1;if (x++==2 ++y==2)//false True =false; x=2,y=2{x = 7;}System.out.println ("x=" +x+ ", y=" +y);The output is:x=2,y=2---------------------------------------------------Second questionint x = 1,y = 1;if (x++==2 ++y==2){x = 7;}System.out.println ("x=" +x+ ", y=" +y);The output is:X=2,y=1---------------------------------------------------Third questionint x = 1,y = 1;if (x++==1 | ++y==1)//true |  false = true; x=2,y=2

Java Asynchronous Processing Simple Practice

=true; Break; }}}}.start (); } /** * * */ Public voidSendfinish () {sendfinish=true; } /** * * */ Public voidrelease () {System. out. println ("release!"); if(BW! =NULL) { Try{bw.close (); } Catch(IOException e) {//TODO print log. } } //in fact, using queue = null is enough. if(Queue! =NULL) {queue.clear (); Queue=NULL; } } /** * * */ Public voidsendmsg (String text) {if(Text! =NULL!Text.isempty ()) {Queue.add (text);

Practice Java Wait (), notify (), sleep Method--a multi-threaded face question

) {e.printstacktrace (); } } } } After the run, the print results become ACBACB. To avoid this uncertainty related to JVM scheduling. The a,b,c three threads need to be started in a certain order, with the final code as follows: Public classMyThreadPrinter2ImplementsRunnable {PrivateString name; PrivateObject prev; PrivateObject Self; PrivateMyThreadPrinter2 (String name, Object prev, object self) { This. Name =name; This. prev =prev; This. Self =Self ; } @Overrid

Blue Bridge cup Java basic Practice Turtle Rabbit Race Forecast

; - intTime = 0; - while(S1 l) { - if(S1-s2 >= T) {//Rabbit Stop + if((L-S2)/V2 //The turtle reaches the finish line first -Time + = (L-S2)/v2; +S2 =l; A}Else{//The turtle can't reach the end atTime + =s; -S2 + = v2 *s; - } - -}Else{//Rabbits Keep -time++; inS1 + = V1 * 1; -S2 + = v2 * 1; to } + } - if(S1 >S2) { theSystem.out.println ("R"); * System.out.pr

Java Concurrent Programming Practice reading notes (1) thread safety and object sharing

2. Thread security 2.1 What is thread-safeWhen multiple threads are accessed, the program can be " correct ", which is thread-safe.An object that has no status (a class that can be understood as having no fields) must be thread safe.2.2 atomicityIn a typical case, the i++ in a multithreaded state is not secure. Because i++ is actually implemented in a number of steps, the execution of multiple threads can be confusing to each other.Race condition (Race Conditions)Threads and threads need to depe

NOTES: Java Concurrency Practice 2

EXEC2 =NewWithinthreadexecutor (); Public Static voidMain (string[] args)throwsIOException {serversocket socket=NewServerSocket (80); while(true) { FinalSocket connection =socket.accept (); Runnable Task=NewRunnable () { Public voidrun () {//HandleRequest (connection); } }; Exec.execute (Task); } }}classThreadpertaskexecutorImplementsExecutor { Public voidExecute (Runnable r) {NewThread (R). Start (); };}classWithinthreadexecutorImplementsExecuto

Total Pages: 15 1 .... 9 10 11 12 13 .... 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.