java学习笔记第19篇第21篇.pptVIP

  • 0
  • 0
  • 约5.72千字
  • 约 19页
  • 2017-06-07 发布于湖北
  • 举报
* * * * * * * 第21章 Java SE6新功能简介 Java SE6基本新功能 Apache Derby、JDBC 4.0 java.lang套件 在Java SE 6中,String类别上新增了isEmpty()方法 String str = ; if(str.isEmpty()) { … } java.util套件 在Java SE 6中,Arrays类别新增了copyOf()方法 int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, arr1.length); for(int i = 0; i arr2.length; i++) System.out.print(arr2[i] + ); System.out.println(); int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, 10); for(int i = 0; i arr2.length; i++) System.out.print(arr2[i] + ); System.out.println(); java.util套件 copyOfRange()方法 binarySearch()方法 int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, 1, 4); int[] arr1 = {10, 20, 30, 40, 50, 60, 70, 80, 90}; int result = Arrays.binarySearch(arr1, 6, 9, 85); if(result -1) { System.out.printf(索引%d处找到数据%n, result); } else { System.out.printf(插入点%d %n, (result + 1) * -1); } java.util套件 在Java SE 6中,您可以直接使用getDisplayNames()或getDisplayName()方法取得区域化的日期格式显示 Calendar rightNow = Calendar.getInstance(); Locale locale = Locale.getDefault(); System.out.println(现在时间是:); System.out.printf(%s:%d %n, rightNow.getDisplayName(ERA, LONG, locale), rightNow.get(YEAR)); System.out.println( rightNow.getDisplayName(MONTH, LONG, locale)); System.out.printf(%d日%n, rightNow.get(DAY_OF_MONTH)); System.out.println( rightNow.getDisplayName(DAY_OF_WEEK, LONG, locale)); java.io套件 使用System类别上新增的console()方法 使用Console物件的readLine()方法 System.out.print(输入名称:); String name = System.console().readLine(); System.out.print(输入密码:); char[] passwd = System.console().readPassword(); String password = new String(passwd); if(caterpillar.equals(name) 123456.equals(passw

文档评论(0)

1亿VIP精品文档

相关文档