wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes i am still getting compile time error in this program plz give me solution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

i am still getting compile time error in this program plz give me solution

vijayreddy patil
Greenhorn

Joined: Feb 12, 2008
Posts: 5
public class SimpleDotCom
{
int [] locationCells;
int numOfHits = 0;

public void setLocationCells(int [] locs)
{
locationCells = locs;
}

public String checkYourself(String stringGuess)
{
int guess = Integer.parseInt(stringGuess);
String result = "miss";
for (int cell : locationCells)
{
if (guess == cell)

result = "hit";
numOfHits++;
break;

}

if(numOfHits == locationCells.length)

result = "kill";

System.out.println(result);
return result;
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Please do not post the same question more than once.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: i am still getting compile time error in this program plz give me solution
 
Similar Threads
Beginner Ques. from Head Start Java book
HeadFirst SimpleDotCom compile
Enhanced for loop
Getting 6 errors with the use of result(noob)
still this code gives compile time error