cancel
Showing results for 
Search instead for 
Did you mean: 

Error parsing output

Former Member
0 Kudos

Hi There,

New to the Java World and Im getting the following error when submitting this java program for compilation and output. Output is Via a html page

// just import the BufferedReader and inputstream reader

import java.io.BufferedReader;

import java.io.InputStreamReader;

class addtwonumbers

{

public static void main(String[] args)

{

// system.in reader (e.g. the input from the console)

InputStreamReader ISR = new InputStreamReader(System.in);

// buffer the console reader

BufferedReader BR = new BufferedReader(ISR);

// the default values for the two numbers

int val1 = 0;

int val2 = 0;

try

{

// output the question.

System.out.print("Enter two Numbers:\n");

// read in the console intput one line (BR.readLine) and then convert to a integer

val1 = Integer.parseInt(BR.readLine());

val2 = Integer.parseInt(BR.readLine());

}

catch (Exception ex)

{

//if the input was a string.

System.out.println(ex.toString());

}

// output the answer of adding both of the values together and * by 3

System.out.println("The result is " + (val1 + val2) * 3 );

}

}

The error message is "Error parsing output, please try again"

Thanks In advance.

Edited by: Conor O'Neill on Mar 16, 2009 4:11 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Following is what you have to do to execute this program

Open command prompt

Enter the following command to compile

javac addtwonumbers.java

If the above line is executed successfully

use

java addtwonumbers

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj

Thanks for getting back to me: yes I already have done what you suggested and it works fine, but I'm trying to output in an HTML page (in a table).

Former Member
0 Kudos

>

> Hi Ayyapparaj

>

> Thanks for getting back to me: yes I already have done what you suggested and it works fine, but I'm trying to output in an HTML page (in a table).

Hi,

What you mean by HTML page(in a table)?

Code what you have written above is a pure application that need to be run in the way i have mentioned above.

If you are interested to create a HTML page where you can enter two numbers and print their out put. You need to change the code altogether.

Regards

Ayyapparaj