Results 1 to 4 of 4
Thread: Illegal start of expression
- 11-25-2011, 09:05 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
Illegal start of expression
Hey there,
I'm in a spot of bother and really struggling with finding what the problem,
Java Code:import javax.swing.JOptionPane; public class ProcessingSpeed { public static void main (String args[]) {; String output = "\n"; int arraySize = Keyboard.getInt("enter the amount of processors"); String[] processors = new String[arraySize]; int[] clockspeed = new int[arraySize]; int[] databus = new int[arraySize]; int[] cachememory = new int[arraySize]; int[] points = new int[arraySize]; String[] stars = new String[arraySize]; int[] clockpoints = new int[arraySize]; for (int loop = 0; loop<arraySize; loop++) {; processors[loop] = Keyboard.getText("Please enter the processor"); clockspeed[loop] = Keyboard.getInt("please enter the clock speed of processor"); databus[loop] = Keyboard.getInt("please enter the lines on data bus"); cachememory[loop] = Keyboard.getInt("please enter the amount of cache memory"); //============================================================================ //calculate clockspeed points if (!(clockspeed[] < 2)) {; clockpoints[] == 10; else if (!(clockspeed[] > 2 || clockspeed[] <= 3)) clockpoints[] = 20; else (!(clockspeed[] > 3)) clockpoints[] = 30; };// end if //============================================================================ // calculate cache memory points double pointsforcache = cachememory[]/10; String pointsforcache0dp = String.format("%0f" , pointsforcache); int pointc = pointsforcache0dp; //============================================================================= //calucate total points int points = clockpoints[] + pointc + databus; //============================================================================= //calculate stars given if (!(points[] <=50)){; stars[] = "*"; };// end if if (!(points[] > 50 && points[] <=150)){; stars[] = "**"; }; // end if if (!(points[] > 200)){; stars[] = "***"; };//end if }// end loop //================================================================================ output += processors[] + " " + points[] + "" + stars[]; Screen.display(output, "processor"); }//end main }//end class
The errors i get when i complile is this;
----jGRASP exec: javac -g ProcessingSpeed.java
ProcessingSpeed.java:24: illegal start of type
if (!(clockspeed[] < 2)) {;
^
ProcessingSpeed.java:24: illegal start of expression
if (!(clockspeed[] < 2)) {;
^
i get the same error for the rest of the program.
Any help would be appreciated, its been bothering me for the past 6 hours.Last edited by Robster; 11-25-2011 at 09:06 PM. Reason: made mistake on copy and paste
- 11-25-2011, 09:16 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: Illegal start of expression
What's that semi colon doing there at the end of line #24?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-25-2011, 09:18 PM #3
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
Re: Illegal start of expression
it was just one of the mistakes i have made here which i would have fixed as i continued to sort it. But i can't seem to find or understand why i am getting this error.
- 11-26-2011, 07:43 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: Illegal start of expression
I gave it a bit closer look; your code is full of errors, e.g. you're using those square brackets [] all over the place and they don't belong there. There are spurious semi colons everywhere and that Keyboard (class?) isn't defined anywhere; if I were you I'd start again because this code is beyond repair ...
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Another Illegal Start of Expression
By miss_peaches in forum New To JavaReplies: 2Last Post: 05-11-2011, 04:41 PM -
Illegal start of expression
By lodaSchitt in forum New To JavaReplies: 2Last Post: 04-28-2011, 10:04 PM -
Illegal start of expression
By Nigel in forum New To JavaReplies: 5Last Post: 03-11-2011, 12:42 PM -
Illegal Start of an Expression
By ddatta8 in forum New To JavaReplies: 3Last Post: 12-20-2008, 08:40 PM -
illegal start of expression
By razmyasdfg in forum CLDC and MIDPReplies: 2Last Post: 07-27-2008, 10:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks