Created
October 21, 2012 08:24
-
-
Save binjoo/3926319 to your computer and use it in GitHub Desktop.
JAVA:英雄联盟语录
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class sdf { | |
public static void main(String[] args) { | |
String uri = "X:\\英雄联盟语录.txt"; | |
try { | |
List<String> list = new ArrayList<String>(); | |
File file = new File(uri); | |
FileInputStream fis = new FileInputStream(file); | |
InputStreamReader isr = new InputStreamReader(fis); | |
BufferedReader br = new BufferedReader(isr); | |
String str = ""; | |
while ((str = br.readLine()) != null) { | |
if (str.equals("")) { | |
continue; | |
} | |
list.add("#英雄联盟语录#" + str); | |
} | |
Collections.shuffle(list); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment