MCPcopy
hub / github.com/DuGuQiuBai/Java / main

Method main

day21/code/day21_IOTest/src/cn/itcast_05/StringDemo.java:22–44  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

20 */
21public class StringDemo {
22 public static void main(String[] args) throws IOException {
23 // ��ȡ�ļ����ݣ���һ�Σ����ַ������ܡ�
24 BufferedReader br = new BufferedReader(new FileReader("s.txt"));
25 String line = br.readLine();
26 br.close();
27
28 // ���ַ���ת�����ַ�����
29 char[] chs = line.toCharArray();
30
31 // ���ַ������������
32 Arrays.sort(chs);
33
34 // ���ַ�����ת���ַ���
35 String s = String.valueOf(chs);
36
37 // ���ַ���д���ı��ļ�
38 BufferedWriter bw = new BufferedWriter(new FileWriter("ss.txt"));
39 bw.write(s);
40 bw.newLine();
41 bw.flush();
42 bw.close();
43
44 }
45}

Callers

nothing calls this directly

Calls 3

readLineMethod · 0.45
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected