chris x barrett

Greenhorn
+ Follow
since Dec 20, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by chris x barrett

any ideas?
18 years ago
ok thanks .. i didn't have an ide at my dispolal at the time .. i will get that... hopfully it will make it easyer....... but in the file i am trying to take a user input "accountname" and create a file named "accountname" and i try to do that by
the directory is my home directory don't know if that matters... but when i run my program it runs fine untill these lines and then crashes... that is what it isn't sapposed to do ...
18 years ago
i want to check and see if there is a file with a certian name and i don't know how ...i don't want to read from the file just want to know the name of the file.
18 years ago
thank you

i am still can't find/figure out why i keep getting that error though.
[ December 20, 2005: Message edited by: chris barrett ]
18 years ago
that isn't saposed to be a smile. i didn't use the code button.
18 years ago
ok now i am saposed to upgrade the code to ask for a userinput as well and use ArrayList to make my life easyer but again i get a compile problem not with the extended for loop anymore though now the error is



[ December 20, 2005: Message edited by: chris barrett ]
[ December 20, 2005: Message edited by: chris barrett ]
18 years ago
ok i figured out the problem .. it was the compiler that i was using wasn't using java 5. it was using an older version so when i tryed it in bluej it compiles and runs. before i was using Jcreator and i don't know how to (or if you can) change the version of java it compiles with. But original problem fixed
18 years ago
This is the class that gives me the error
errors are

';' expected on line 17
illegal start of expression on line 31
illegal start of expression on line 32


1public class SimpleDotCom
2{
3int[] locationCells;
4int numOfHits = 0;
5
6public void setLocationCells(int[] locs)
7{
8locationCells = locs;
9}
10
11public String checkYourself(String stringGuess)
12{
13int guess = Integer.parseInt(stringGuess);
14String result = "miss";
15//int cell = 0;
16for (int cell : locationCells) // i = 0; i < 7; i ++)
17{
18if (guess == cell)
19{
20result = "hit";
21numOfHits++;
22//cell++;
23break;
24}
25}
26if (numOfHits == locationCells.length)
27{
28result = "kill";
29}
30System.out.println(result);
31return result;
32}
33}
18 years ago
i checked that too to make sure and i have java 1.5
18 years ago
my compiler won't compile this for loop

for (int cell : locationCells)

it says that the colon should be a semicolon... i am using a book to do this program and that is what it calls for and i know there are for loops as such

for (int i = 0; i < 10; i++)

i can't figure out what the problem it ��??
18 years ago