当方法单一时,它工作正常。
String as = System.getProperty("line.separator");
ArrayList<String> products = new ArrayList<String>();
products.add("Banana" +as+ "Its color is yellow.");
products.add("Orange" +as+ "Orange is a sour fruit.");
products.add("Onion" +as+ "Onion usually used on Pizza");
如果它被分成多个;这没用。
String as = System.getProperty("line.separator");
ArrayList<String> products = new ArrayList<String>();
addFirstThousand(products);
addSecondThousand(products);
private void addFirstThousand(ArrayList<String> products) {
products.add("Banana" +as+ "Its color is yellow.");
products.add("Orange" +as+ "Orange is a sour fruit.");
products.add("Onion" +as+ "Onion usually used on Pizza");
}
private void addSecondThousand(ArrayList<String> products) {
products.add("Apple" +as+ "Apple is a big corporation");
products.add("Love" +as+ "Love is releted to heart");
products.add("Pizza" +as+ "It's origineted from Italy");
}
为了更容易理解:
如何将其拆分为多个?