help with error
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")
}
}
}
snitch321
Junior Poster in Training
63 posts since Nov 2007
Reputation Points: 9
Solved Threads: 2
is the keyword public spelled public or Public?
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
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)' ?
snitch321
Junior Poster in Training
63 posts since Nov 2007
Reputation Points: 9
Solved Threads: 2
Because it is case sensitive, public is a keyword, Public could be a class or anything really.
ShawnCplus
Code Monkey
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
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.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
so, judging from my coding what would the name be?
snitch321
Junior Poster in Training
63 posts since Nov 2007
Reputation Points: 9
Solved Threads: 2
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.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
lol well ive literally just staretd learnin basic java at uni, and we've been given a project,so time will tell.
snitch321
Junior Poster in Training
63 posts since Nov 2007
Reputation Points: 9
Solved Threads: 2