Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF: error compiling this code...Help

 
Frederico Werly
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i have a problem ..

--------------------------
HF: Example page 84 .

package com.example.web;

import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeerSelect extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selection Advice<br>");
String c = request.getParameter("color");

BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();
While(it.hasNext()) {
out.print("<br>try: "+ it.next());
}

}
}

The ERROR :
src/com/example/web/BeerSelect.java:21: ';' expected
While(it.hasNext()) {
^
1 error
-----------------------------------------------------
What is wrong with my code ?
Thanks for answer ...
 
Gabriel Forro
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

try while (...) instead of While(...)
 
Frederico Werly
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok .. RUN !

Thank you .. sorry .. i will pay atention next time :-(
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic