摘要: 1 package 对象比较排序; 2 3 import java.util.Arrays; 4 5 class A implements Comparable<A>{ 6 private String name; 7 private int age; 8 public A(String name, 阅读全文
posted @ 2017-04-07 23:58 xiongjiawei 阅读(554) 评论(0) 推荐(0) 编辑
摘要: 1 package Arrays类; 2 3 import java.util.Arrays; 4 5 public class TestArrays { 6 public static void main(String[] args) { 7 int[] a={1,9,3,5,7,8,2,6,0, 阅读全文
posted @ 2017-04-07 23:19 xiongjiawei 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 1 package 日期日历类; 2 3 import java.text.ParseException; 4 import java.text.SimpleDateFormat; 5 import java.util.Date; 6 7 public class TestDate { 8 publ 阅读全文
posted @ 2017-04-07 22:25 xiongjiawei 阅读(751) 评论(0) 推荐(0) 编辑
摘要: 1 public class TestDate { 2 public static void main(String[] args) { 3 System.out.println(new java.util.Date()); 4 } 5 } 运行结果:Fri Apr 07 21:56:24 CST 阅读全文
posted @ 2017-04-07 21:58 xiongjiawei 阅读(1855) 评论(0) 推荐(0) 编辑
摘要: 1 package 彩票中奖码生成器; 2 3 import java.util.Random; 4 5 public class TestRandom { 6 public static void main(String[] args) { 7 Random random=new Random() 阅读全文
posted @ 2017-04-07 21:00 xiongjiawei 阅读(2025) 评论(0) 推荐(0) 编辑
摘要: 1 package math; 2 3 public class TestMath_round { 4 public static void main(String[] args) { 5 System.out.println(Math.round(0.5));//1 6 System.out.pr 阅读全文
posted @ 2017-04-07 20:21 xiongjiawei 阅读(438) 评论(0) 推荐(0) 编辑
摘要: 1 package 对象克隆; 2 class A implements Cloneable{//要具备clone()功能必须要实现Cloneable接口,此接口里无方法,只起标识作用。 3 private String value; 4 public A(String value){ 5 this 阅读全文
posted @ 2017-04-07 20:03 xiongjiawei 阅读(1541) 评论(0) 推荐(0) 编辑
摘要: 1 package 对象被回收前执行的操作; 2 class A{ 3 @Override 4 protected void finalize() throws Throwable { 5 System.out.println("在对象变成垃圾被gc收回前执行的操作。"); 6 } 7 } 8 pu 阅读全文
posted @ 2017-04-07 19:28 xiongjiawei 阅读(1146) 评论(0) 推荐(0) 编辑
摘要: 1 public class Test_currentTimeMillis { 2 public static void main(String[] args) { 3 long start=System.currentTimeMillis(); 4 for(int i=0;i<Integer.MA 阅读全文
posted @ 2017-04-07 19:19 xiongjiawei 阅读(818) 评论(0) 推荐(0) 编辑