Home>Network programming tutorial> Java tutorial
All ASP tutorial ASP tutorial ASP.NET tutorial PHP tutorial JSP tutorial C#/CSHARP tutorial XML tutorial Ajax tutorial Perl tutorial Shell tutorial Visual Basic tutorial Delphi tutorial Mobile development tutorial C/C++ tutorial Java tutorial J2EE/J2ME Software engineering
Java tutorial
  • How to get the web container address in java

    How to get the web container address in java

    tomcat local addressE:/soft4develop/apache-tomcat-6.0.18System.getProperty("user.dir")//E:/soft4develop/apache-tomcat-6.0.18/binSystem.getProperty("catalina.home")/ /E:/soft4develop/apache-tomcat-6.0.18 is also applicable to jboss. Oth
    2024-11-19
  • Several methods and time for executing mysql batch insert under java

    Several methods and time for executing mysql batch insert under java

    Method 1: Java code copy code is as follows: conn = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASS); pstmt = conn.prepareStatement("insert into loadtest (id, data) values ​​(?, ?)"); for (int i = 1; i <= COUNT; i++) {pstmt.clearPa
    2024-11-19
  • Implement code to upload multiple files at the same time in struts2

    Implement code to upload multiple files at the same time in struts2

    Name multiple file field objects with the same name in the upload.jsp page, so that multiple file fields can be parsed into an array in the action. The size of the array is the number of file fields. At the same time, one file field is parsed into Three c
    2024-11-19
  • Solution to the problem of garbled file names when downloading files in Java

    Solution to the problem of garbled file names when downloading files in Java

    复制代码代码如下:public static String toUtf8String(String s) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c >= 0 && c <= 255) { sb.append(c); } else { byte[] b; try { b = Character.toString(c).g
    2024-11-19
  • Java:DocumentBuilderFactory calls XML method instance

    Java:DocumentBuilderFactory calls XML method instance

    First get: get the factory instance of the DOM parser DocumentBuilderFactory domfac=DocumentBuilderFactory.newInstance(); and then get the DOM parser DocumentBuilder dombuilder=domfac.newDocumentBuilder(); from the DOM factory.) Convert the XML document t
    2024-11-19
  • A simpler method of double bracket initialization using anonymous inner classes in java

    A simpler method of double bracket initialization using anonymous inner classes in java

    Java's collection frameworks such as set, map, and list do not provide any convenient methods for initialization. Every time you create a collection, you have to add the values ​​one by one. For example, the copied code is as follows: Set<Character
    2024-11-19
  • Introduction to the use of JAVA arrays

    Introduction to the use of JAVA arrays

    There are three main differences between JAVA arrays and container classes: efficiency, type, and the ability to save basic types. In JAVA, arrays are the most efficient way to store and randomly access a sequence of object references. An array is a simpl
    2024-11-19
  • Dive into Java Final

    Dive into Java Final

    The JAVA keyword final is used to modify data, methods or classes, which usually means "unchangeable", that is, data cannot be changed, methods cannot be overridden, and classes cannot be inherited. There are generally two reasons for using fina
    2024-11-19
  • Several methods of page jump in java servlet

    Several methods of page jump in java servlet

    Servlet: Of course, in servlets, jumps generally occur in doGet, doPost and other methods. 1) The redirect method is response.sendRedirect("/a.jsp"); the path of the page is a relative path. sendRedirect can jump to any page, not necessarily lim
    2024-11-19
  • The use of shuffle algorithm in Java

    The use of shuffle algorithm in Java

    Basic idea of ​​FisherYates shuffle (Knuth shuffle): To shuffle an array a of n elements (indices 0..n-1):for i from n − 1 downto 1 doj ← random integer with 0 ≤ j ≤ iexchange a[j] and a[i] The JDK source code is as follows: Copy the code as follows: /***
    2024-11-19
  • How to use Java bitmap sorting

    How to use Java bitmap sorting

    The sorting algorithm of container classes in java JDK mainly uses insertion sort and merge sort. The implementation of different versions may be different. The key code is as follows: Copy the code and the code is as follows: /*** Performs a sort on the
    2024-11-19
  • Analysis of the difference between java_String and StringBuffer

    Analysis of the difference between java_String and StringBuffer

    The string provided by this StringBuffer class is modified. You can use StringBuffer when you know the character data is going to change. Typically, you use StringBuffers to dynamically construct character data. There are three classes in Java that are re
    2024-11-19
  • Example code for batch modifying file names in Java

    Example code for batch modifying file names in Java

    Copy the code as follows: import java.io.*; import java.util.*; public class Test {public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new FileReader("output1.txt" ));List<String> newName = new
    2024-11-19
  • Analysis of the difference between Hashtable and HashMap in java

    Analysis of the difference between Hashtable and HashMap in java

    1. Hashtable is a subclass of Dictionary. The copy code is as follows: public class Hashtable<K,V>extends Dictionary<K,V>implements Map<K,V>, Cloneable, java.io.Serializable HashMap: The copy code is as follows :public class HashMap<K
    2024-11-19
  • Using regular expressions to extract the contents of ( ) in java

    Using regular expressions to extract the contents of ( ) in java

    I encountered a small problem yesterday. I needed to process some users in batches. The format of the users sent from the front desk was as follows. I wanted to extract the content between the brackets (without brackets) Teacher 10 (0010) Teacher 11 (0011
    2024-11-19