sorry to be a nuisance, but ive solved my other problems but now come acropt another one. The problem is that the line highlighted has an error message saying '<identifier> expected' . What do i do to solve it?

/**
 * create an input temperature gauge.
 * 
 * @author (chris twaits) 
 * @version (12/10/07)
 */
 public class temperature
{
    private System.out.printIn;

    /**
     * create input and response for user.
     * Method does all the work.
     */

    public void input (int temperature)
    {
       if(0 < 20) {
          System.out.printIn("wear some shorts and sandals");
       }
       else {
          System.out.printIn("please insert only numbers,ranging from -40 to 75");
       }  
    }


}

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Either you trying to implement new method "printIn" for PrintStream or you have spelling mistake as you want to use simple PRINTLN (in capital in case you mistake L for capital i or number one "1").
So your turn, tell us what you trying to do...

Can you please out your code in [code] [/code] tags, seeing as it makes it easier to read. I mention it becasue you are not a new poster, you have almost 30 of them.

your code does not make any sense

to declare a private field, you write "private <type> <name>;"

so your line doesn't make sense because "System.out.printIn" is not a type and there is no name

1) Declare a package. You should never place anything in the "default" package.

2) The classname should be Capitalised.

3) The line you're refereing to makes no sense. First of all I believe you mean println not printIn (the first one is a lowercase L the second one, yours, is an uppercase I). Secondly that's a method and you are using it as a (I don't know what). Thirdly you're declaring it (private, protected, public keywords are only used in declarations) which makes even less sense. Thirdly, no matter what you wanted to do with it, the line is imcomplete (and basically just wrong).

4) You do realise that if (0 < 20) will always be true, right? And, I definately would not want to wear shorts and sandals when the temperature is at least 13 degrees fahrenheit below freezing.

5) And I will assume that you simply haven't even started attempting to get input from the user yet, regardless of what that comment says.

Comments
Right on par! you're the man :D

I think that you've added private System.out.printIn; in attempt to fix the error you would have gotten with System.out.printIn("wear some shorts and sandals"); I agree with Masijade, you meant println . Java would have complained that it had not found the method you where trying to use.

Regardless, I think you meant to check the variable temperature against 20. That is, I think you meant if (temperature < 20) though you're missing the alternative message. If indeed the temperature is valid and 20 or above, I suspect a message needs to be output. Thus you'd need a nested if statement.

im grateful for all of your help guys and realised that my coding was missing alot out and i tried to shortcut too much, cheers guys you helped me realise that.

This article has been dead for over six months. Start a new discussion instead.