title: Reading a text file
body: <p>I need help on this code.
  The input is stored in a text file like this:</p>
  
  <pre>
  First:3 6 
  Secon:3 9 
  </pre>
  
  <p>The output is: </p>
  
  <pre><code>First:3 6 
  
  The Maximum number is6
  
  The sum is9
  
  
  Secon:3 9 
  
  
  The Maximum number is9
  
  The sum is12
  </code></pre>
  
  <p>But my desired output should be : </p>
  
  <pre><code>    The Maximum number is6
      The sum is12 
  </code></pre>
  
  <p>So,it applies Math.max() on the first line only.
  And,it add the second line numbers.</p>
  
  <p>Please help.</p>
  
  <pre><code>import java.io.*;
  
  public class cape 
  {
   public static void main(String args[])
    {
    try{
  
    FileInputStream fstream = new FileInputStream("C:/Users/PC4599/Desktop/cape.txt"); // Open the text file.
    DataInputStream in = new DataInputStream(fstream);// Get the object of DataInputStream
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
  
    String MyString;
  
  
    //Read File Line By Line
    while ((MyString = br.readLine()) != null) 
    {
  
    // Print the content on the console
    System.out.println (MyString);
  
  
    Character c = new Character(MyString.charAt(6));
    Character c2 = new Character(MyString.charAt(8));
  
  
  
    String s = c.toString();
    String s2 = c2.toString(); 
  
  
    int i = Integer.parseInt(s);
    int i2 = Integer.parseInt(s2);
  
      int sum=i+i2;
    System.out.println("The Maximum number is"+ Math.max(i, i2));
    System.out.println("The sum is"+ sum);
  
    }
    //Close the input stream
    in.close();
    }catch (Exception e){
     //Catch exception if any
    System.err.println("Error: " + e.getMessage());
    }
    }
  }
  </code></pre>