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
  • Java implementation method of redefining arrays (similar to VB's ReDim)

    Java implementation method of redefining arrays (similar to VB's ReDim)

    Copy the code as follows: //param objArr the expanded object of Array. //param newLength the length of the new Array public static Object getNewArr(Object objArr, int newLength) { if (!objArr.getClass().isArray()) {//Judge the type return null; } // get t
    2024-11-19
  • Java various slide switching effects (classic)

    Java various slide switching effects (classic)

    Functional implementation: 1. Image loading class ImageLoader implementation: 1) Use blocking queue to store the desired image: BlockingQueue images = new ArrayBlockingQueue<>(2); 2) Use image eof to indicate the end of the image queue: Image eof =
    2024-11-19
  • Java string word frequency statistics example code

    Java string word frequency statistics example code

    Copy the code as follows: package com.gpdi.action; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class WordsStatistics { class Obj { int count; Obj(int count){ this.
    2024-11-19
  • A small example of converting floating point numbers into RMB using Java

    A small example of converting floating point numbers into RMB using Java

    Copy the code as follows: import java.util.ArrayList; import java.util.List; public class RMBConverter2 implements IRMBConverter { private static final String [] RMB_NUMBER ={"zero","one","two","three", "四&quot
    2024-11-19
  • Java implementation method of two-dimensional array matrix multiplication

    Java implementation method of two-dimensional array matrix multiplication

    复制代码代码如下:public interface IMatrixMultiple { public int[][] mmltiple(int[][]a ,int [][]b); } ?public class MatrixMultiple implements IMatrixMultiple { @Overridepublic int[][] mmltiple(int[][] a, int[][] b) { int [][] result = new int[a.length][b[0].length]
    2024-11-19
  • URL breakpoint download in Java

    URL breakpoint download in Java

    Copy the code as follows: URL ur = new URL("http://localhost:8080/first/he.txt");HttpURLConnection conn = (HttpURLConnection) ur.openConnection();//URL.openConnection() --> return URLCommection (direct subclass HttpURLConnection)conn.setReque
    2024-11-19
  • JAVA time interval string validity verification

    JAVA time interval string validity verification

    Copy the code as follows: String[] zone1="08:30-11:00".split("-");String[] zone2="13:00-17:00".split("-");String [] actzone="9:00-11:00".split("-");DateFormat df = new SimpleDateFormat("hh:m
    2024-11-19
  • The difference between static keyword and final keyword in java

    The difference between static keyword and final keyword in java

    static1. In a class, attributes modified with static are called static attributes. It is common to all objects of this class and is stored in the static storage area. All objects of this class can access and access the same variable. Can be used as a coun
    2024-11-19
  • Implementation method of Java multi-threaded download

    Implementation method of Java multi-threaded download

    Copy the code as follows: package cn.me.test;import java.io.InputStream;import java.io.RandomAccessFile;import java.net.HttpURLConnection;import java.net.URL;/*** Multi-threaded download* 1: Use RandomAccessFile to write data at any location. *2: The amou
    2024-11-19
  • Four methods and some characteristics of implementing singleton mode in JAVA

    Four methods and some characteristics of implementing singleton mode in JAVA

    1. Hungry-Chinese style singleton class copy code code is as follows: public class Singleton { private Singleton(){ } private static Singleton instance = new Singleton(); private static Singleton getInstance(){ return instance; } } Features: Hungry-Chines
    2024-11-19
  • Explanation on the use of hashCode method

    Explanation on the use of hashCode method

    First of all, to understand the role of hashCode, you must first know the collection in Java. Generally speaking, there are two types of collections in Java, one is List, and the other is Set. Do you know their difference? The elements in the former set
    2024-11-19
  • Spring scheduled task implementation code in java

    Spring scheduled task implementation code in java

    Copy the code as follows: import org.apache.log4j.*; public class TaskJob {public static Logger log = Logger.getLogger(TaskJob.class); public void SayHello() {// TODO Auto-generated method stubtry {log.info ("Processing task starts>......");/
    2024-11-19
  • Example code based on socket communication implemented in Java

    Example code based on socket communication implemented in Java

    Server-side code: Copy the code as follows: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class Server {public static void main(String[] args ) {ServerSocket server;try{server
    2024-11-19
  • How to deal with garbled characters in Servlet in Java

    How to deal with garbled characters in Servlet in Java

    When deploying a webservices program today, the servlet that obtains data from the page encountered a garbled problem. In the servlet, I added the text request.setCharacterEncoding("GB2312"); to the code, but the garbled problem still occurred.
    2024-11-19
  • How to count each character of a string in java

    How to count each character of a string in java

    Copy the code as follows:/* String name = "adsbsadgsadgtewterfsdf"; eg a-->6,b-->1 d-->3... Save the string as a (letter) => 2 (number) Ideas into the Map collection framework: 1. Convert the string into a character array. 2. Define
    2024-11-19