contains an integer array parameter, passing in an array of scores* Use the Arrays class to sort the result array and output* Returns the number of elements in the array after the method executes*/public int sort (int[]scores) {Arrays.sort (scores);System.out.println (arrays.tostring (scores));Returns the number of elements in an arrayreturn scores.length;}}Operation Result:[52, 79, 81, 98]A total of 4 results information!This article is from "Ghost"
Channels are used in concert with the buffer in NIO. A channel is a bidirectional channel that is readable and writable. It is a bit similar to stream, but stream is unidirectional, the application does not directly perform read/write operations on the channel, but must use the buffer. For example, when reading a channel, you must first read the data into the corresponding buffer and then read it in the buffer.
An example of using filechannel
Package
Java technology accumulation-use the original code to witness the paging query implementation principle, java Paging
You are familiar with paging query. The datagrid encapsulated in easyui fully applies a series of table operations. Paging query is one of them. However, we are not familiar with the basic implementation principle of paging query. How is it actuall
There are two ways to create Java threads, and here we learn through simple Examples.multi-threading creation in Java one, creating multithreading by inheriting the thread class public classHellothreadextendsThread {@Override public voidRun () {Try{TimeUnit.SECONDS.sleep (1); System.out.println ("Hello from a thread!"); } Catch(interruptedexception E) {e.printstacktrace (); } } public Static voidMain
currently in a similar directory.3. ThinkingWhy not just write the absolute path?A: In our actual development process is basically a team development, with the help of SVN and other code synchronization. We cannot guarantee that the storage path of each local project is consistent, some may be in the D drive, some in the E drive. The above approach ensures that the path ahead of the project is dynamically fetched, and that the owner's local project storage location is different and does not aff
This article uses the latest version 3.0 driver package. Maven Address
Note that the 2.6 version of the Java driver and the old version is very different, this article is based on the 3.0 version of the driverNo authentication connection MONGDB server
Import com.mongodb.MongoClient;
Import com.mongodb.MongoClientOptions;
Import com.mongodb.MongoCredential;
Import com.mongodb.MongoException;
Import Com.mongodb.WriteConcern;
Import Com.mongodb.DB;
I
AppFuse is an open source project and application that uses open source tools built on the Java platform to help us develop WEB applications quickly and efficiently. I originally developed it to reduce the unnecessary time it takes to build a new WEB application for a customer. At the core, AppFuse is a skeleton of the project, similar to what the IDE creates when you create a new Web project through a wizard. When we create a project using AppFuse, i
[Java] does not use third-party variables to exchange values of two variables. java third-party Variables
During language learning and program design, the most common way to exchange two variables is to use the temp new variable for conversion. The Code is as follows:
-----------------------------------------
--------
begin to answer examinee pool-1-thread- 9 hand over to see if Countdownlatch's Countdown method can block me! See how Countdownlatch's Countdown can clog me up! Examinee pool-1-thread-10 hand over to see Countdownlatch of Countdown method can block me live! Examinee pool-1-thread-7 hand over to see Countdownlatch of Countdown method can block me live! Examinee pool-1-thread-4 hand over to see Countdownlatch of Countdown method can block me live. Examinee pool-1-thread-3 hand over to see Countdo
by calling the show () method of the objectOperation Result:TaskCheck the work again!!!In the editor, a method named Showmylove with no parameter return value is defined to output the information. Please complete the code in section 5, 8, and lineThe result of the operation is:1 Public classHelloWorld {2 3 Public Static voidMain (string[] args) {4 //Create object, object named Hello5 6 7 //Calling Methods8 9 }Ten One /* A * Method for d
= % JAVA_OPTS %-server-XX: PermSize = 128 m-XX: MaxPermSize = 512 m.
After this method is tried, the exception persists. After the PermSize is changed, restart tomcat and the exception persists.
Method 2: orModify the catalina. sh/bat file:
rem catalina.bat
set JAVA_OPTS=-Xms64m -Xmx256m -XX:PermSize=128m -XX:MaxNewSize=256M -XX:MaxPermSize=256m
#catalina.shJAVA_OPTS=-Xms64m-Xmx256m-XX:PermSize=128m-XX:MaxNewSize=256m-XX:MaxPerSize=256m
Failed to restart tomcat
Method 3:Add the following at the
If you do not use left-join or other multi-table join queries, you can use only single-table queries and Java programs to easily implement multi-table queries.
As we mentioned last time, the left-loin clause is not used to associate queries. It may be to improve efficiency or configure cache, or to simplify the compilation of SQL statements. It is really easy to
Java: use static fields and constructors to query the number of created objects. java Constructor
Problem: using static fields and constructors of a class, we can track the number of objects created by a class.
Please write a class and you can query it at any time, "How many objects have you created ?".
Program Design ideas:
Learn about the use of the Wait method and the Notify method in Java multi-threading.Use of the wait and notify methods a simple instance of wait and notifyImportJava.util.concurrent.TimeUnit; Public classWaitthreadtest { Public Static voidMain (string[] args)throwsException {Object Object=NewObject (); NewWaitthread (Object). Start (); TimeUnit.SECONDS.sleep (2);//wake up after 2 seconds NewNotifyth
In Java, the lock that follows the Synchronized keyword is freed when the thread leaves the range of the synchronization block, even if it is out of scope because of an exception. Therefore, when using the synchronized keyword in Java, the exception causes the deadlock to occur without releasing the lock, which never occurs.
Lock Interace in place of the synchronized keyword,
Java Algorithm interview question: recursive algorithm question 2 1st people 10, 2nd people two years older than 1st people, recursive in turn, please use recursion to calculate the size of 8th People ?, Java Recursion
Package com. swift; public class Digui_Return {public static void main (String [] args) {/** recursive algorithm question 2 1st people 10, 2nd pe
The use of the file class in the JAVAI/O section of the Java---(note)In Java, I/O (input/output) is a tedious thing, because I do not see the obvious effect, but the input/output is a necessary part of all programs-using the input mechanism, allowing the program to read external data (including data from disk, CD and other storage devices), user input data, using
When more than one Java is installed in a Linux system, we can switch the Java version automatically when the original configuration file is not modified:[Email protected] ~]# update-alternatives--config java650) this.width=650; "title=" 3118.tmp.jpg "style=" height:160px;width:737px "src=" http://s4.51cto.com/wyfs02/M00/ 89/20/wkiom1gicoew4dxbaaau_kx0tym965.jpg "width=" 881 "height=" 156 "alt=" Wkiom1gicoe
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.