does anyone know how to fix the problem here;(it says 'Public void input(int)' that line has a problem?

/**
* Write a description of class randommizer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class temperature
{
private int input;


/**
* create input and response for user
*/


public temperature()
{
// do nothing
}



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



}

Recommended Answers

All 9 Replies

I'm no profesional here but it looks like you may be missing a bit.... uh... what is this gonna do anyways?

is the keyword public spelled public or Public?

that was indeed a mistake that i have now corrected, but yet it still says their is a problem with this line 'Public void input(int)' ?

Because it is case sensitive, public is a keyword, Public could be a class or anything really.

that was indeed a mistake that i have now corrected, but yet it still says their is a problem with this line 'Public void input(int)' ?

Method parameters have a type and a name. You have only specified a type.

so, judging from my coding what would the name be?

Anything you want it to be - it's just a variable name. You need to brush up a bit on basic Java syntax and structure a bit more if you expect to get anywhere at all with this.

usually the idea of arguments is that you would use them in your method, so you need to give it a name

lol well ive literally just staretd learnin basic java at uni, and we've been given a project,so time will tell.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.