|
-
Help Java
Im using JCreator. and im getting an error when i compile this.
public static char computeLetterGrade(float percentGrade) {
if (percentGrade < 50) {
return 'F';
else if ((percentGrade >= 50) && (percentGrade < 60))
return 'D';
else if ((percentGrade >= 60) && (percentGrade < 70))
return 'C';
else if ((percentGrade >= 70) && (percentGrade < 80))
return 'B';
else
return 'A';
}
}
The error is:
'class' or 'interface' expected
public static char computeLetterGrade(float percentGrade) {
^
What should be changed?
-
NullPointerException
Re: Help Java
What you have there is just a method. You either need to convert it to a class or write a class around it. Any file Blah.java must contain a public class Blah.
Open Source is free like a puppy is free.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
Understanding Evolution
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|