如何读取文件并将数据存储到字符串数组中

-5 java

嗨有一个名为read.txt的文件,下面是文件内的数据.

OS:B,A,Linux,Windows 7,Windows     
ARCH:32 Bit,64 Bit    
Browser:Chrome,Firefox,IE   
Run Code Online (Sandbox Code Playgroud)

我想读取该文件,并希望通过使用
":"符号拼写将数据存储到每个列的String数组中.

示例如下

String a[] = { "A","B","Linux", "Windows 7", "Windows" };    

String b[] = { "32 Bit", "64 Bit"};    

String c[] = { "Chrome", "Firefox" ,"IE"};  
Run Code Online (Sandbox Code Playgroud)

Sam*_*ava 5

一种方法是通过ReadLine提取每一行.一旦我们有一个包含该行的字符串,就假设我们有一个":"作为分隔符来拆分该行.提取数组的第二个元素,并使用","作为分隔符进行另一个分割