This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes still this code gives compile time error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "still this code gives compile time error" Watch "still this code gives compile time error" New topic
Author

still this code gives compile time error

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;
}
}
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What error?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20077
    
  30

Compiles perfectly on my machine (JDK 1.6.0_03)


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
Have you checked out Aspose?
 
subject: still this code gives compile time error
 
jQuery in Action, 3rd edition