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 small example of recursively traversing directories

    Java small example of recursively traversing directories

    Copy the code as follows: public static void main(String[] args) {File f = new File("D://test//fsd");listChids(f,0);}public static void listChids(File f, int level){String preSrt = "";for(int i=0;i
    2024-11-25
  • Java method to replace carriage returns and line feeds in strings

    Java method to replace carriage returns and line feeds in strings

    Use regular expressions to replace: Code snippet: String documentTxt = EntityUtils.toString(entity,"gbk");//Get data documentTxt=documentTxt.replaceAll("[//t//n//r]", "" );//Remove the carriage return and line feed in the con
    2024-11-25
  • Solution to the Chinese garbled value passed in the java page URL

    Solution to the Chinese garbled value passed in the java page URL

    The Chinese problem is a problem often encountered in applications. This will involve character decoding operations. In our applications, we often use new String(fieldType.getBytes("iso-8859-1"), "UTF-8"); and other similar methods to
    2024-11-25
  • Commonly used sorting methods in java

    Commonly used sorting methods in java

    Copy the code as follows: package com.test;import java.util.Random;/*** Sorting test class* * The classification of sorting algorithms is as follows: 1. Insertion sort (direct insertion sort, half insertion sort, Hill sort); 2. Exchange sort (bubble sort,
    2024-11-24
  • About Struts2 file upload and custom interceptor

    About Struts2 file upload and custom interceptor

    1. Access or add the request/session/application attribute public String scope() throws Exception{ActionContext ctx = ActionContext.getContext();ctx.getApplication().put("app", "Application scope");//Go to ServletContext Put appctx.get
    2024-11-24
  • Obtain IP address through network card name in java

    Obtain IP address through network card name in java

    Copy the code as follows: package me.xuzs.sso.test;import java.net.InetAddress;import java.net.NetworkInterface;import java.net.SocketException;import java.util.Enumeration;public class InternetTest {public static void main (String[] args) {String netCard
    2024-11-24
  • A small example of java controlling automatic printing of Pdf

    A small example of java controlling automatic printing of Pdf

    复制代码代码如下:public byte[] autoPrintPdf(byte[] pdf_byte) {ByteArrayOutputStream bos=null;try {PdfReader reader = new PdfReader(pdf_byte);bos = new ByteArrayOutputStream();PdfStamper ps = new PdfStamper(reader, bos);StringBuffer script = new StringBuffer(); sc
    2024-11-24
  • Example of Java calling DOS to implement scheduled shutdown

    Example of Java calling DOS to implement scheduled shutdown

    Copy the code as follows: public static void shutdown(){System.out.print("Please enter the number of minutes to shut down:");Scanner scanner = new Scanner(System.in);int minute = scanner.nextInt()*60 ;Runtime runtime = Runtime.getRuntime();Strin
    2024-11-24
  • Javafx implementation of image 3D flip effect method example

    Javafx implementation of image 3D flip effect method example

    Implementation steps: 1. Define the FlipView object. Contains the following properties: Copy code code as follows: //Front view public Node frontNode; //Reverse view public Node backNode; //Whether to flip boolean flipped = false; //Flip angle DoublePrope
    2024-11-24
  • Based on the difference between stack and heap in Java, relevant introduction to the garbage collection mechanism in Java

    Based on the difference between stack and heap in Java, relevant introduction to the garbage collection mechanism in Java

    #. There are two types of memory in java. They are called stack and heap respectively. The stack is the program memory space, so all basic types and object references are stored in the stack. The heap is where the Java virtual machine stores objects. It i
    2024-11-24
  • Application based on common methods related to HttpServletResponse

    Application based on common methods related to HttpServletResponse

    public void filedownload(HttpServletResponse response) throws Exception { ServletContext context = this.getServletContext(); String path = context.getRealPath("/download/awf.jpg"); String filename = path.substring(path.lastIndexOf("//") + 1); // 如果下载文件为中文
    2024-11-24
  • Application based on common methods related to HttpServletRequest

    Application based on common methods related to HttpServletRequest

    Referer:public void referer(HttpServletRequest request, HttpServletResponse response)throws Exception {String referer = request.getHeader("referer");if (referer == null || !referer.startsWith("http://localhost")) {response.sendRedirect("/webTwo/index.jsp"
    2024-11-24
  • IO instruction manual introduction

    IO instruction manual introduction

    When determining whether a file object is a file or directory, you must first determine whether the content encapsulated by the file object exists, and judge by exists; When constructing the text file operation stream, you can also specify the encoding me
    2024-11-24
  • Analysis of the inheritance structure of common IO operation classes in java

    Analysis of the inheritance structure of common IO operation classes in java

    IO common IO operation class inheritance structure IO character stream Reader (source) BufferedReaderLineNumberReaderInputStreamReaderFileReader (bridge from byte stream to character stream) StringReaderWriter (purpose) BufferedWriterOutputStreamWriterFil
    2024-11-24
  • Introduction to List Learning in Java Collection

    Introduction to List Learning in Java Collection

    List is an ordered collection that allows duplication of elements; the implementation is not synchronized and if multiple threads access a List instance and at least one of them structurally modifies the table (adds or removes elements), then it needs to
    2024-11-24