954,141 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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
 

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") } } }


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

kingvjack
Light Poster
28 posts since Aug 2006
Reputation Points: 13
Solved Threads: 0
 

is the keyword public spelled public or Public?

masijade
Industrious Poster
Moderator
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
Team Colleague
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
Moderator
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
Moderator
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

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

bugmenot
Posting Whiz in Training
225 posts since Nov 2006
Reputation Points: 53
Solved Threads: 34
 

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
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You