Home> Network programming 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
Network programming tutorial
  • 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
  • Java join thread control usage

    Java join thread control usage

    JDK description: joinpublic final void join() throws InterruptedException waiting for the thread to terminate. Throws: InterruptedException - if any thread interrupts the current thread. When this exception is thrown, the interrupt status of the current t
    2024-11-19
  • Various implementation methods of java keyboard input

    Various implementation methods of java keyboard input

    Example program: 1. Use Scanner to read integer or float data from the keyboard. Copy the code as follows: //import java.io.*;import java.util.*;public class InputTest{public static void main(String[] args){Scanner in = new Scanner(System.in); //Scanner c
    2024-11-19
  • java.net.SocketException: Connection reset solution

    java.net.SocketException: Connection reset solution

    Since the SEOTcs system updated the SEO scoring algorithm on November 24, a problem that has been bothering me has appeared. The following error will often be reported during the execution of the Java data job task: "2011-12-03 18:00 :32 DefaultHttpC
    2024-11-19
  • How to implement java scheduled tasks

    How to implement java scheduled tasks

    复制代码代码如下:package com.ucap.sms;import java.util.Timer;import javax.servlet.ServletContextEvent;import javax.servlet.ServletContextListener;public class SmsListener implements ServletContextListener{private Timer timer=null;public void contextDestroyed(Serv
    2024-11-19
  • Common thread pool example code in java

    Common thread pool example code in java

    Copy the code as follows: package com.smart.frame.task.autoTask;import java.util.Collection;import java.util.Vector;/*** Task distributor*/public class TaskManage extends Thread{protected Vector<Runnable> tasks = new Vector<Runnable>();protect
    2024-11-19
  • Example code for java multi-thread copying files

    Example code for java multi-thread copying files

    Copy the code as follows: package com.test; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; public class FileCoper { private static final String _ORIGIN_FILE_MODE = "r"; private static final Str
    2024-11-19
  • Java example code for splitting and merging large files

    Java example code for splitting and merging large files

    Copy the code as follows: package com.test; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io. IOException; import java.util.Collections
    2024-11-19
  • Detailed introduction to the difference between static variables and instance variables in java

    Detailed introduction to the difference between static variables and instance variables in java

    Running effect: Console effect: ============================================= =======Code part========================================== =========/hello_test/src/com/b510/test/StaticTest.java Copy the code as follows:/*** */package com.b510.test;/*** The
    2024-11-18
  • How to create a thread using the Thread class in java threads

    How to create a thread using the Thread class in java threads

    There are two ways to create threads in Java: using the Thread class and using the Runnable interface. When using the Runnable interface, you need to create a Thread instance. Therefore, whether you create a thread through the Thread class or the Runnable
    2024-11-18