按点(.)切分,必须要注意转义!如:split("\\."). 例子: public class Test { public static void main(String[] args) { String s = "adhahd.txt"; String t[] = s.split("\\."); for(int i = 0; i < t.length; i++){ System.out.println(t[i]); } } } publ…
Java编程中获取键盘输入实现方法及注意事项 1. 键盘输入一个数组 package com.wen201807.sort; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int len = sc.nextInt(); int[] array = new…