I have just embarked on a Java programming course and have been given a task to work out the volume of a cylinder in cubic inches with a given radius and height. and then to convert it from cubic inches to to cubic Cm's which i have done fine.
My problem is it wont complie with an error on one of the
lines that i have in the program
i have checked that i have the syntax correct and it still wont compile.
Would some one be able to give me some advice
I know this is going to sound like a totaly dumb request but hey we all have to start somewhere dont we

12 Years
Discussion Span
Last Post by server_crash

Post the error that you're getting. Often, a syntax error may not be on the line given by the message. It could be a few lines up and the effect of the error isn't seen by the parser until that line.


Check for missing semi colens ';'

That would be my first attempt at finding the problem.


I slightly modified your post's topic to make it more polite. " Very New to Java and need help ASAP" implied that you deserve precedence over someone else's post, which is kind of considered poor etiquette. Additionally, your thread title has no relevance to your actual question. Creating a relevant thread title also helps you attract people who could help with your problem.

Just letting you know for future reference.


Hi thanks for replying to my request i have checked and double checked everything and still cant get it to compile. i hope its not too much to ask if you could have a look at this for me.
thanks i advance if you can

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class InputCircle

    public static void main(final String [] pArgs) throws IOException


    final InputStreamReader tInputStreamReader = new InputStreamReader(System.in);
    final BufferedReader tKeyboard = new BufferedReader(tInputStreamReader);

            final double tPi = 3.141592653589793;
            double tRadius, tArea, tDiameter, tCircumfrence, tNum1,tLine1 ;
            tRadius = (tLine1);
            tArea = tPi * tRadius * tRadius;
            tDiameter = tRadius + tRadius;
            tCircumfrence = tPi * tDiameter;

    String tFirstLine = tKeyboard.readLine();
    tFirstLine = tFirstLine.trim();
    int tFirstInt = Integer.parseInt(tFirstLine);
    System.out.print("Type in a number That is the Radius of you Circle ");

    final String tLine1 = tKeyboard.readLine();
    final int tNum1 = Integer.parseInt(tLine1);

    final String tLine2 = tKeyboard.readLine();
    final int tNum2 = Integer.parseInt(tLine2);

    System.out.println("The subtraction is" + (tNum1 - tNum2));

Edited by Dani: Formatting fixed


Thanks for letting me know the rules and stuff i am Pretty new to forums in fact very new its the first time i have ever used one. I will bear in mind what you have said if i need more help

Thanks for the Advice grifflyn


You have alot of conversion problems that need to be fixed. But even when they are fixed the program doesnt really work the way you have it. If you want to convert the input to a double do something like this:

Double d = Double.valueOf(BufferedReaderVariableName.readLine().trim());
double d2 = d.doubleValue();

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.