Java中常用的代码汇总(值得收藏的)

值得收藏的一些Java实战项目分享 今天来给大家分享几个值得作为Java新手收藏实战的项目 阅读详情

Java中常用的代码汇总(值得收藏的)

    1. 字符串有整型的相互转换 String a = String.valueOf(2);   //integer to numeric string   int i = Integer.parseInt(a); //numeric string to an int2. 向文件末尾添加内容 BufferedWrite...

    1. 字符串有整型的相互转换

    String a = String.valueOf(2);   //integer to numeric string  
    int i = Integer.parseInt(a); //numeric string to an int

    2. 向文件末尾添加内容

    BufferedWriter out = null; 
    try { 
      out = new BufferedWriter(new FileWriter(”filename”, true)); 
      out.write(”aString”); 
    } catch (IOException e) { 
      // error processing code 
    } finally { 
      if (out != null) { 
        out.close(); 
      } 
    }

    3. 得到当前方法的名字 

    String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();

    4. 转字符串到日期

    java.util.Date = java.text.DateFormat.getDateInstance().parse(date String);
    //或者是:
    SimpleDateFormat format = new SimpleDateFormat( "dd.MM.yyyy" );  
    Date date = format.parse( myString );

    5. 使用JDBC链接Oracle

    public class OracleJdbcTest 
    { 
      String driverClass = "oracle.jdbc.driver.OracleDriver"; 
      
      Connection con; 
      
      public void init(FileInputStream fs) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException 
      { 
        Properties props = new Properties(); 
        props.load(fs); 
        String url = props.getProperty("db.url"); 
        String userName = props.getProperty("db.user"); 
        String password = props.getProperty("db.password"); 
        Class.forName(driverClass); 
      
        con=DriverManager.getConnection(url, userName, password); 
      } 
      
      public void fetch() throws SQLException, IOException 
      { 
        PreparedStatement ps = con.prepareStatement("select SYSDATE from dual"); 
        ResultSet rs = ps.executeQuery(); 
      
        while (rs.next()) 
        { 
          // do the thing you do 
        } 
        rs.close(); 
        ps.close(); 
      } 
      
      public static void main(String[] args) 
      { 
        OracleJdbcTest test = new OracleJdbcTest(); 
        test.init(); 
        test.fetch(); 
      } 
    }

    6. 把 Java util.Date 转成 sql.Date 

    java.util.Date utilDate = new java.util.Date(); 
    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());

    7. 使用NIO进行快速的文件拷贝

    public static void fileCopy( File in, File out ) 
          throws IOException 
      { 
        FileChannel inChannel = new FileInputStream( in ).getChannel(); 
        FileChannel outChannel = new FileOutputStream( out ).getChannel(); 
        try
        { 
    //     inChannel.transferTo(0, inChannel.size(), outChannel);   // original -- apparently has trouble copying large files on Windows 
      
          // magic number for Windows, 64Mb - 32Kb) 
          int maxCount = (64 * 1024 * 1024) - (32 * 1024); 
          long size = inChannel.size(); 
          long position = 0; 
          while ( position < size ) 
          { 
            position += inChannel.transferTo( position, maxCount, outChannel ); 
          } 
        } 
        finally
        { 
          if ( inChannel != null ) 
          { 
            inChannel.close(); 
          } 
          if ( outChannel != null ) 
          { 
            outChannel.close(); 
          } 
        } 
      }

    8. 创建图片的缩略图

    private void createThumbnail(String filename, int thumbWidth, int thumbHeight, int quality, String outFilename) 
        throws InterruptedException, FileNotFoundException, IOException 
      { 
        // load image from filename 
        Image image = Toolkit.getDefaultToolkit().getImage(filename); 
        MediaTracker mediaTracker = new MediaTracker(new Container()); 
        mediaTracker.addImage(image, 0); 
        mediaTracker.waitForID(0); 
        // use this to test for errors at this point: System.out.println(mediaTracker.isErrorAny()); 
      
        // determine thumbnail size from WIDTH and HEIGHT 
        double thumbRatio = (double)thumbWidth / (double)thumbHeight; 
        int imageWidth = image.getWidth(null); 
        int imageHeight = image.getHeight(null); 
        double imageRatio = (double)imageWidth / (double)imageHeight; 
        if (thumbRatio < imageRatio) { 
          thumbHeight = (int)(thumbWidth / imageRatio); 
        } else { 
          thumbWidth = (int)(thumbHeight * imageRatio); 
        } 
      
        // draw original image to thumbnail image object and 
        // scale it to the new size on-the-fly 
        BufferedImage thumbImage = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB); 
        Graphics2D graphics2D = thumbImage.createGraphics(); 
        graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); 
        graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null); 
      
        // save thumbnail image to outFilename 
        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outFilename)); 
        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); 
        JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(thumbImage); 
        quality = Math.max(0, Math.min(quality, 100)); 
        param.setQuality((float)quality / 100.0f, false); 
        encoder.setJPEGEncodeParam(param); 
        encoder.encode(thumbImage); 
        out.close(); 
      }

    9.创建 JSON 格式的数据

    并下面这个JAR 文件:json-rpc-1.0.jar (75 kb)/http://t.cn/Rz0bhUA

    import org.json.JSONObject; 
    ... 
    ... 
    JSONObject json = new JSONObject(); 
    json.put("city", "Mumbai"); 
    json.put("country", "India"); 
    ... 
    String output = json.toString(); 
    ...

    10. 使用iText JAR生成PDF

    import java.io.File; 
    import java.io.FileOutputStream; 
    import java.io.OutputStream; 
    import java.util.Date; 
      
    import com.lowagie.text.Document; 
    import com.lowagie.text.Paragraph; 
    import com.lowagie.text.pdf.PdfWriter; 
      
    public class GeneratePDF { 
      
      public static void main(String[] args) { 
        try { 
          OutputStream file = new FileOutputStream(new File("C:\\Test.pdf")); 
      
          Document document = new Document(); 
          PdfWriter.getInstance(document, file); 
          document.open(); 
          document.add(new Paragraph("Hello Kiran")); 
          document.add(new Paragraph(new Date().toString())); 
      
          document.close(); 
          file.close(); 
      
        } catch (Exception e) { 
      
          e.printStackTrace(); 
        } 
      } 
    }

    11. HTTP 代理设置

    System.getProperties().put("http.proxyHost", "someProxyURL"); 
    System.getProperties().put("http.proxyPort", "someProxyPort"); 
    System.getProperties().put("http.proxyUser", "someUserName"); 
    System.getProperties().put("http.proxyPassword", "somePassword");

    12. 单实例Singleton 示例

    public class SimpleSingleton { 
      private static SimpleSingleton singleInstance = new SimpleSingleton(); 
      
      //Marking default constructor private 
      //to avoid direct instantiation. 
      private SimpleSingleton() { 
      } 
      
      //Get instance for class SimpleSingleton 
      public static SimpleSingleton getInstance() { 
      
        return singleInstance; 
      } 
    }

    13. 抓屏程序

    import java.awt.Dimension; 
    import java.awt.Rectangle; 
    import java.awt.Robot; 
    import java.awt.Toolkit; 
    import java.awt.image.BufferedImage; 
    import javax.imageio.ImageIO; 
    import java.io.File; 
      
    ... 
      
    public void captureScreen(String fileName) throws Exception { 
      
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 
      Rectangle screenRectangle = new Rectangle(screenSize); 
      Robot robot = new Robot(); 
      BufferedImage image = robot.createScreenCapture(screenRectangle); 
      ImageIO.write(image, "png", new File(fileName)); 
      
    } 
    ...

    14. 列出文件和目录 

    File dir = new File("directoryName"); 
     String[] children = dir.list(); 
     if (children == null) { 
       // Either dir does not exist or is not a directory 
     } else { 
       for (int i=0; i < children.length; i++) { 
         // Get filename of file or directory 
         String filename = children[i]; 
       } 
     } 
      
     // It is also possible to filter the list of returned files. 
     // This example does not return any files that start with `.'. 
     FilenameFilter filter = new FilenameFilter() { 
       public boolean accept(File dir, String name) { 
         return !name.startsWith("."); 
       } 
     }; 
     children = dir.list(filter); 
      
     // The list of files can also be retrieved as File objects 
     File[] files = dir.listFiles(); 
      
     // This filter only returns directories 
     FileFilter fileFilter = new FileFilter() { 
       public boolean accept(File file) { 
         return file.isDirectory(); 
       } 
     }; 
     files = dir.listFiles(fileFilter);

    15. 创建ZIP和JAR文件 

    import java.util.zip.*; 
    import java.io.*; 
      
    public class ZipIt { 
      public static void main(String args[]) throws IOException { 
        if (args.length < 2) { 
          System.err.println("usage: java ZipIt Zip.zip file1 file2 file3"); 
          System.exit(-1); 
        } 
        File zipFile = new File(args[0]); 
        if (zipFile.exists()) { 
          System.err.println("Zip file already exists, please try another"); 
          System.exit(-2); 
        } 
        FileOutputStream fos = new FileOutputStream(zipFile); 
        ZipOutputStream zos = new ZipOutputStream(fos); 
        int bytesRead; 
        byte[] buffer = new byte[1024]; 
        CRC32 crc = new CRC32(); 
        for (int i=1, n=args.length; i < n; i++) { 
          String name = args[i]; 
          File file = new File(name); 
          if (!file.exists()) { 
            System.err.println("Skipping: " + name); 
            continue; 
          } 
          BufferedInputStream bis = new BufferedInputStream( 
            new FileInputStream(file)); 
          crc.reset(); 
          while ((bytesRead = bis.read(buffer)) != -1) { 
            crc.update(buffer, 0, bytesRead); 
          } 
          bis.close(); 
          // Reset to beginning of input stream 
          bis = new BufferedInputStream( 
            new FileInputStream(file)); 
          ZipEntry entry = new ZipEntry(name); 
          entry.setMethod(ZipEntry.STORED); 
          entry.setCompressedSize(file.length()); 
          entry.setSize(file.length()); 
          entry.setCrc(crc.getValue()); 
          zos.putNextEntry(entry); 
          while ((bytesRead = bis.read(buffer)) != -1) { 
            zos.write(buffer, 0, bytesRead); 
          } 
          bis.close(); 
        } 
        zos.close(); 
      } 
    }

    16. 解析/读取XML 文件

    XML文件

    <?xml version="1.0"?> 
    <students> 
      <student> 
        <name>John</name> 
        <grade>B</grade> 
        <age>12</age> 
      </student> 
      <student> 
        <name>Mary</name> 
        <grade>A</grade> 
        <age>11</age> 
      </student> 
      <student> 
        <name>Simon</name> 
        <grade>A</grade> 
        <age>18</age> 
      </student> 
    </students>

    Java代码 

    <span style="font-family:Arial;font-size:14px;">package net.viralpatel.java.xmlparser; 
      
    import java.io.File; 
    import javax.xml.parsers.DocumentBuilder; 
    import javax.xml.parsers.DocumentBuilderFactory; 
      
    import org.w3c.dom.Document; 
    import org.w3c.dom.Element; 
    import org.w3c.dom.Node; 
    import org.w3c.dom.NodeList; 
      
    public class XMLParser { 
      
      public void getAllUserNames(String fileName) { 
        try { 
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
          DocumentBuilder db = dbf.newDocumentBuilder(); 
          File file = new File(fileName); 
          if (file.exists()) { 
            Document doc = db.parse(file); 
            Element docEle = doc.getDocumentElement(); 
      
            // Print root element of the document 
            System.out.println("Root element of the document: "
                + docEle.getNodeName()); 
      
            NodeList studentList = docEle.getElementsByTagName("student"); 
      
            // Print total student elements in document 
            System.out 
                .println("Total students: " + studentList.getLength()); 
      
            if (studentList != null && studentList.getLength() > 0) { 
              for (int i = 0; i < studentList.getLength(); i++) { 
      
                Node node = studentList.item(i); 
      
                if (node.getNodeType() == Node.ELEMENT_NODE) { 
      
                  System.out 
                      .println("====================="); 
      
                  Element e = (Element) node; 
                  NodeList nodeList = e.getElementsByTagName("name"); 
                  System.out.println("Name: "
                      + nodeList.item(0).getChildNodes().item(0) 
                          .getNodeValue()); 
      
                  nodeList = e.getElementsByTagName("grade"); 
                  System.out.println("Grade: "
                      + nodeList.item(0).getChildNodes().item(0) 
                          .getNodeValue()); 
      
                  nodeList = e.getElementsByTagName("age"); 
                  System.out.println("Age: "
                      + nodeList.item(0).getChildNodes().item(0) 
                          .getNodeValue()); 
                } 
              } 
            } else { 
              System.exit(1); 
            } 
          } 
        } catch (Exception e) { 
          System.out.println(e); 
        } 
      } 
      public static void main(String[] args) { 
      
        XMLParser parser = new XMLParser(); 
        parser.getAllUserNames("c:\\test.xml"); 
      } 
    }

    17. 把 Array 转换成 Map 

    import java.util.Map; 
    import org.apache.commons.lang.ArrayUtils; 
      
    public class Main { 
      
     public static void main(String[] args) { 
      String[][] countries = { { "United States", "New York" }, { "United Kingdom", "London" }, 
        { "Netherland", "Amsterdam" }, { "Japan", "Tokyo" }, { "France", "Paris" } }; 
      
      Map countryCapitals = ArrayUtils.toMap(countries); 
      
      System.out.println("Capital of Japan is " + countryCapitals.get("Japan")); 
      System.out.println("Capital of France is " + countryCapitals.get("France")); 
     } 
    }

    18. 发送邮件

    import javax.mail.*; 
    import javax.mail.internet.*; 
    import java.util.*; 
      
    public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException 
    { 
      boolean debug = false; 
      
       //Set the host smtp address 
       Properties props = new Properties(); 
       props.put("mail.smtp.host", "smtp.example.com"); 
      
      // create some properties and get the default Session 
      Session session = Session.getDefaultInstance(props, null); 
      session.setDebug(debug); 
      
      // create a message 
      Message msg = new MimeMessage(session); 
      
      // set the from and to address 
      InternetAddress addressFrom = new InternetAddress(from); 
      msg.setFrom(addressFrom); 
      
      InternetAddress[] addressTo = new InternetAddress[recipients.length]; 
      for (int i = 0; i < recipients.length; i++) 
      { 
        addressTo[i] = new InternetAddress(recipients[i]); 
      } 
      msg.setRecipients(Message.RecipientType.TO, addressTo); 
      
      // Optional : You can also set your custom headers in the Email if you Want 
      msg.addHeader("MyHeaderName", "myHeaderValue"); 
      
      // Setting the Subject and Content Type 
      msg.setSubject(subject); 
      msg.setContent(message, "text/plain"); 
      Transport.send(msg); 
    }

    19. 发送代数据的HTTP 请求

    import java.io.BufferedReader; 
    import java.io.InputStreamReader; 
    import java.net.URL; 
      
    public class Main { 
      public static void main(String[] args) { 
        try { 
          URL my_url = new URL("http://coolshell.cn/"); 
          BufferedReader br = new BufferedReader(new InputStreamReader(my_url.openStream())); 
          String strTemp = ""; 
          while(null != (strTemp = br.readLine())){ 
          System.out.println(strTemp); 
        } 
        } catch (Exception ex) { 
          ex.printStackTrace(); 
        } 
      } 
    }

    20. 改变数组的大小

    /** 
    * Reallocates an array with a new size, and copies the contents 
    * of the old array to the new array. 
    * @param oldArray the old array, to be reallocated. 
    * @param newSize  the new array size. 
    * @return     A new array with the same contents. 
    */
    private static Object resizeArray (Object oldArray, int newSize) { 
      int oldSize = java.lang.reflect.Array.getLength(oldArray); 
      Class elementType = oldArray.getClass().getComponentType(); 
      Object newArray = java.lang.reflect.Array.newInstance( 
         elementType,newSize); 
      int preserveLength = Math.min(oldSize,newSize); 
      if (preserveLength > 0) 
       System.arraycopy (oldArray,0,newArray,0,preserveLength); 
      return newArray; 
    } 
      
    // Test routine for resizeArray(). 
    public static void main (String[] args) { 
      int[] a = {1,2,3}; 
      a = (int[])resizeArray(a,5); 
      a[3] = 4; 
      a[4] = 5; 
      for (int i=0; i<a.length; i++) 
       System.out.println (a[i]); 
    }
    Java经典代码 Java经典代码 Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码Java经典代码 立即下载

    相关推荐

    164个java经典代码案例

    经典的java代码例子,希望对你有帮助。

    50个JAVA常见代码大全:学完这篇从Java小白到架构师(附带讲解)

    Java,作为一门流行多年的编程语言,始终占据着软件开发领域的重要位置。无论是初学者还是经验丰富的程序员,掌握Java中常见的代码和概念都是至关重要的。本文将列出50个Java常用代码示例,并提供相应解释,助力你从Java小白成长为架构师。

    penggerhe的博客 1万+

    codemirror6 制作markdown编辑器(源码模式)

    总体上感觉能用,但是不怎么友好,官方文档有点散乱,而且关键字高亮功能是独立出去的,去官方文档找半天,也没找到怎么改。EditorView.theme可以往EditorView模块中修改CSS的样式,从而影响编辑器的样式展示。"### 测试\n\n```javascript\nlet x = 'y'\n```"这个插件中的markdown语法的高亮样式。//这里指定markdown中代码块使用的解析扩展。开头的class样式,并且还需要在选择器前面添加。//markdown语言解析扩展。

    qq_43203949的博客 1783

    JAVA基本代码详解

    java语法详解

    weixin_73252614的博客 7812

    手把手教你用STM32CubeIDE移植Vector CCP驱动,实现与INCA的标定通信(附避坑指南)

    本文详细介绍了如何在STM32CubeIDE环境下移植Vector CCP驱动,实现与INCA的标定通信。从开发环境准备、CAN外设配置到CCP协议栈移植和A2L文件生成,提供了完整的操作流程和常见问题解决方案,帮助工程师快速掌握基于CAN总线的标定技术。

    weixin_28685287的博客 138

    CH340驱动安装全攻略:从Windows到MacOS的避坑指南(2025最新版)

    本文提供2025年最新版CH340驱动安装全攻略,涵盖Windows、MacOS和Linux三大操作系统。详细解析了驱动安装的核心原理、标准流程,并针对Windows设备管理器报错、MacOS系统安全限制等常见“坑点”提供了深度排错与解决方案,旨在帮助开发者快速稳定地完成USB转串口通信配置。

    earth的博客 426

    java 常用代码

    Java常用代码

    lwq597的博客 1万+

    服务器centos上安装IC618(virtuoso)教程

    只需要按照提供的步骤即可实现IC618安装。有需要详情请联系QQ:563962386

    swicthsober的博客 1万+

    一个Java程序员应该掌握的10项技能

    阅读提示:一个合格的Java程序员应该学什么、学到什么程度、怎么学?本文总结了十项Java程序员应该具备的基本技能,供您参考。 Oracle帮您准确洞察各个物流环节1、语法:必须比较熟悉,在写代码的时候IDE的编辑器对某一行报错应该能够根据报错信息知道是什么样的语法错误并且知道任何修正。2、命令:必须熟悉JDK带的一些常用命令及其常用选项,命令至少需要熟悉:appletview

    纷纷雪落 1582

    PythonWeb开发框架—Django之工程创建和models的定义和增删改查

    文章介绍了Django工程的创建、models的定义和增删改查

    weixin_42476668的博客 990

    VLSI数字信号处理系统——第九章滤波器和变换中的算法强度缩减

    [课程学习] VLSI数字信号处理系统——第九章滤波器和变换中的算法强度缩减

    夏风喃喃的博客 1604

    Java常用代码汇总(经典代码)

    1. 字符串有整型的相互转换 String a = String.valueOf(2); //integer to numeric string int i = Integer.parseInt(a); //numeric string to an int 2. 向文件末尾添加内容 BufferedWriter out = null; try { out = new Bu...

    Henrry_优快云的博客 3万+

    长上下文技术的底层逻辑:Attention、压缩、缓存与跨页推理

    如果把模型的参数视为“固化智能”,动态智能(Dynamic Intelligence)——模型不必依赖训练时的记忆,而是可以随时调用外部信息。这一点正在改变大模型的范式:Prompt 不再是输入,而是“操作系统事件”文档不再是知识,而是“模型的临时记忆”模型不再是一段神经网络,而是一个“具备阅读循环的推理引擎”当我们把上下文从 128K 拉到百万级,我们做的不是扩容,而是让模型第一次拥有阅读、回溯、定位、跨页分析的能力。这是一种新的智能。

    aifs2025的博客 997

    java实现收藏功能

    java实现收藏功能 需求分析 分析: 1.要求用户必须登录,否则提示 2.第一次点击,表示收藏成功,收藏数+1,显示蓝色星星 3.第二次点击,表示取消收藏操作,收藏数-1,显示白色星星 ----------------------------------------------------------------------- 核心问题:当前请求时收藏操作,还是取消收藏操作 [这类型的操作,称之为有状态的操作] 解决方案:第一次请求过来时,留下一个记号,第二次请求时候,根据记号有无决定收

    三少 1万+

    学Simulink--环境感知场景实例:基于Simulink的毫米波雷达多目标跟踪仿真

    本文介绍了基于Simulink的毫米波雷达多目标跟踪仿真系统,重点分析了FMCW雷达信号处理流程(Range/Doppler FFT、CFAR检测)和多目标跟踪算法(JPDA数据关联、EKF状态估计)。通过构建城市道路交叉场景,验证了系统在跟踪精度(位置误差<0.2m)、实时性(单帧处理24ms)和鲁棒性(ID切换率<5%)方面的性能优势,并提出了UKF滤波、多传感器融合等优化方向。该仿真系统为自动驾驶环境感知提供了实用的毫米波雷达跟踪解决方案。

    amy_mhd的博客 92

    数学建模模型总结

    这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

    Java中几个常用类方法汇总

    Java中几个常用类方法汇总,如:Integer,Character,String,StringBuilder,StringBuffer等

    qq_43857727的博客 1483

    Devexpress16.2.6破解工具

    Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

    CMD常用命令大全(值得收藏)

    CMD常用命令大全(值得收藏) 文章目录前言一、启动cmd方式二、修改背景三、文件夹命令四、网络相关五、其它常用命令六、cmd快捷键七、JAVA相关八、电脑快捷键 前言 平常在学校上课忘记带鼠标,触摸板又有点不方便。cmd可以解决一大半问题!通过使用窗口命令,实现无鼠标办公!或者你想在朋友面前装个x,不妨运行一下tree 总而言之,cmd命令记一些常用的,还是很有帮助的! 一、启动cmd方式 用户启动,Win+r 输入cmd,Enter 管理员启动,Win+r 输入cmd,Ctrl+Shift+

    张时贰的博客 24万+

    VB摄像头监控

    该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

    LinePhone3.2.7(android端最新版本) sip客户端

    SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

    精品 IDEA 插件大汇总!值得收藏

    轻松提高 Java 开发效率 俗话说,工欲善其事,必先利其器。想要提升编程开发效率,必须选择一款顺手的开发工具。 对于 Java 开发者,JetBrains IDEA 无疑是目前最主流的开发工具,既简单易用、又强大灵活,并且可以通过安装插件全副武装。 今天鱼皮汇总了 IDEA 实用插件,分享给大家,希望帮助大家大幅提高开发效率! 插件较多,建议大家先观看我在 B 站发布的 IDEA 精品插件手把手演示视频,再看本文汇总哦~ 视频地址:https://www.bilibili.com/video/BV1.

    努力做最接地气的编程干货分享,感谢关注 4514

    JAVA常用工具类汇总

    一、字符串工具类 org.apache.commons.lang.StringUtils pom文件: <!-- https://mvnrepository.com/artifact/org.apache.commons/org.apache.commons.lang --> <dependency> <groupId>org.apache.common...

    ourLang 3万+

    【JAVA】Java常用注解汇总

    注解是在Java 5中引入的,通过在代码中使用注解,开发人员可以提供关于程序结构和行为的补充信息,这些信息可以被编译器、工具和运行时环境所利用。不包含任何成员变量的注解称为标记注解,例如上面声明的 Test 注解以及基本注解中的 @Override 注解都属于标记注解。@PostMapping、@GetMapping、@PutMapping、@DeleteMapping:这些注解是@RequestMapping的特定方法级别的变体,用于指定特定HTTP请求方法的映射关系。

    JAVA领域优质创作者,基于分片网络查询方法专利发明者。 1242

    Java常用代码汇总

    1. 字符串有整型的相互转换 Stringa =String.valueOf(2);//integer to numeric string int i = Integer.parseInt(a);//numeric string to an int 2. 向文件末尾添加内容 BufferedWriterout=null; try{ out=newBufferedWri...

    weixin_42784331的博客 690

    常用的Java代码汇总

    常用的Java代码汇总 1. 字符串有整型的相互转换 String a = String.valueOf(2); //integer to numeric string int i = Integer.parseInt(a); //numeric string to an int 2. 向文件末尾添加内容 BufferedWriter out = null;

    我生苍茫 1364
    上一篇: jQuery常用方法
    下一篇: jstl表达式
    评论
    成就一亿技术人!
    拼手气红包6.0元
    还能输入1000个字符
     
     条评论被折叠 查看
    添加红包

    请填写红包祝福语或标题

    个

    红包个数最小为10个

    元

    红包金额最低5元

    当前余额3.43元 前往充值 >
    需支付:10.00元
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付元
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值