This discussion is archived
3 Replies Latest reply: Aug 28, 2008 4:05 PM by 807589 RSS

new to multiple methods

807589 Newbie
Currently Being Moderated
hey i trying to learning coding using an arraylist and i have to read from command line for a special word and save the arraylist as a file but i'm having problems in writing it with multiple methods
public static void main(String[] args) throws IOException {
list = new ArrayList<String>();
commandsave(list);
Scanner sc = new Scanner(System.in);
commandread1(sc);
}
public static void commandread1(Scanner sc) throws IOException {
while (sc has text) {
String text= text.nextLine();
if (!text.equals("")) {
Scanner sc2 = new Scanner(text);
String letter = sc.next();

if (letter equals something) commandsave(*What goes in here*); ////my ecilpse keeps telling
// me to set as null but then i can't compile i tried to change it to args but still getitng error
}
}
public static void commandsave(ArrayList<String> list) throws IOException {
String arg2 = *args[1]*; /// ecilpse also says error with the args, has nothing to
// do with it being 1 because i've used args[0] somewhere before for
// another section of code and it's fine just getting problem with this
followed by the printerwiter/bufferedwriter and filewriter  to give formating of the document
}