だから私は内容としてこれだけを持つ.txtファイルを持っています:
pizza 4
bowling 2
sleepover 1
私がやろうとしているのは、たとえば最初の行で、「ピザ」の部分を無視し、4 を整数として保存することです。
ここに私がこれまでに持っている小さなコードがあります。
public static void addToNumber() {
  PrintWriter writer;
  Int pizzaVotes, bowlingVotes, sleepOverVotes;
   try {
     writer = new PrintWriter(new FileWriter("TotalValue.txt"));
     }
   catch (IOException error) {
     return;
     }
   // something like if (stringFound)
   //      ignore it, skip to after the space, then put the number
   //      into a variable of type int
   //      for the first line the int could be called pizzaVotes
        //   pizzaVotes++;
        //  then replace the number 4 in the txt file with pizzaVote's value
        //  which is now 5.
        //  writer.print(pizzaVotes); but this just overwrites the whole file.
        // All this  will also be done for the other two lines, with bowlingVotes
        // and sleepoverVotes.
      writer.close();
   } // end of method
私は初心者です。ご覧のとおり、実際に機能するコードは非常に短く、先に進むべきかわかりません。誰かが私を正しい方向に向けてくれるほど親切で、サイトへのリンクを教えてくれるだけでも、それは非常に役に立ちます...
編集:私は愚かにも PrintWriter がファイルを読み取ることができると思っていました