Int Vars = įor(int Counter = 0 Counter Their_Defense) Ideally, I'd rather put all these variables into a table/array/arraylist and use a for statement to assign them, something like String Grabbed_Line = Grabber.nextLine().split(",") P2TrueTies = Integer.parseInt(Grabbed_Line) P2Losses = Integer.parseInt(Grabbed_Line) P1TrueTies = Integer.parseInt(Grabbed_Line) P1Losses = Integer.parseInt(Grabbed_Line) TrueTies = Integer.parseInt(Grabbed_Line) String Grabbed_Line = Grabber.nextLine().split(",") Also, all variables getting an integer value are int types. There will never be more or less than 12 numbers on this first line, so there will never be an issue with out of bounds. As an example, I am reading a text document with Grabber, a Scanner object, with one line of text that will look like this: Here is my current code snippet, without posting all the other information, assume that everything works correctly.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |