摘要: 第一种方式: 看TimeStamp类的源码: 1 public Timestamp(long time) { 2 super((time/1000)*1000); 3 nanos = (int)((time%1000) * 1000000); 4 if (nanos < 0) { 5 nanos = 阅读全文
posted @ 2020-12-23 11:07 想当好程序员的骚年 阅读(3453) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test2 { 2 static int Ef(int[] arr,int ed){ 3 int left = 0; 4 int right = arr.length-1; 5 while(left <= right){ 6 int tmp = (left+right) 阅读全文
posted @ 2020-11-27 17:28 想当好程序员的骚年 阅读(337) 评论(0) 推荐(0) 编辑
摘要: @Test public void test2() throws Exception { Properties pro = new Properties(); //读取配置文件的方式一: /*FileInputStream fis = new FileInputStream("src/jdbc.pr 阅读全文
posted @ 2020-11-06 20:35 想当好程序员的骚年 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 目的: 想将userInfo文件中的数据加载到Properties对象当中。userInfo文件内容: 代码: package com.yc.day0830; import java.io.FileNotFoundException; import java.io.FileReader; impor 阅读全文
posted @ 2020-08-30 11:44 想当好程序员的骚年 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 用到的知识点有:FileInputStream、FileOutputStream、File对象的常用方法、重点是递归方法和路径的拼接。 package com.yc.day0829; import java.io.*; /** * @program: javaSE * 描述: * 将D:\\aa文件 阅读全文
posted @ 2020-08-29 17:47 想当好程序员的骚年 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 描述: 通过定时器,完成在控制台中,输出,倒计时5秒,输出吃饭了。 方法一:使用了Thread.sleep() public class CDemo { public static void main(String[] args) { Timer ti = new Timer(); TimerTas 阅读全文
posted @ 2020-08-11 19:29 想当好程序员的骚年 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1.特点:当第一次用到本类时,静态代码块执行唯一的一次。 静态内容总是优先于非静态,所以静态代码块比构造方法先执行。 2.静态代码块的典型用途: 用来一次性对静态成员变量进行赋值。 public class StaticDemo { static{ System.out.println("静态代码块 阅读全文
posted @ 2020-08-09 10:58 想当好程序员的骚年 阅读(246) 评论(0) 推荐(0) 编辑
摘要: package com.yc.day0807; import java.util.Arrays; /** * @program: javaSE * 描述: * 冒泡排序 从小到大 * @author: yc * @create: 2020-08-07 14:09 **/ public class D 阅读全文
posted @ 2020-08-08 14:34 想当好程序员的骚年 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 1 public class ADemo { 2 public static void main(String[] args) { 3 Scanner sc = new Scanner(System.in); 4 System.out.println("请输入字符串"); 5 String str 阅读全文
posted @ 2020-08-05 19:33 想当好程序员的骚年 阅读(413) 评论(0) 推荐(0) 编辑
摘要: public class List4Demo { public static void main(String[] args){ ArrayList<Integer> li = new ArrayList<>(); li.add(436); li.add(1); li.add(1); li.add( 阅读全文
posted @ 2020-07-31 16:45 想当好程序员的骚年 阅读(191) 评论(0) 推荐(0) 编辑