摘要: 一、数组声明 两种形式(方括号位置放变量前后都可以): int arr[ ]; int[ ] arr2; 二、数组初始化 数组初始化也有两种形式,如下(使用new或不使用new): int arr[] = new int[]{1, 3, 5, 7, 9}; int[] arr2 = {2, 4, 6 阅读全文
posted @ 2019-03-22 17:13 StarZhai 阅读(16389) 评论(0) 推荐(1) 编辑
摘要: 一、字符串查找 ①indexOf(String s) 该方法用于返回参数字符串s在指定字符串中首次出现的索引位置,当调用字符串的indexOf()方法时,会从当前字符串的开始位置搜索s的位置;如果没有检索到字符串s,该方法返回-1 ②lastIndexOf(String str) 该方法用于返回字符 阅读全文
posted @ 2019-03-22 15:14 StarZhai 阅读(8397) 评论(0) 推荐(0) 编辑
摘要: 格式1:Scanner sc = new Scanner (new BufferedInputStream(System.in))格式2:Scanner sc = new Scanner (System.in);在读入数据量大的情况下,格式1的速度会快些。读一个整数: int n = sc.next 阅读全文
posted @ 2019-03-22 13:39 StarZhai 阅读(181) 评论(0) 推荐(0) 编辑