3 Replies Latest reply: Sep 22, 2008 1:38 PM by 795426 RSS

    Enum not initialized

    800610
      Hi Guys

      I am trying to get my enum working but I am getting problems. See code:
      public class Set extends HttpServlet
      {
           private enum URLType { CHECKFORM, INSERTFORM};
      
           public void doPost(HttpServletRequest request, HttpServletResponse response)
                                        throws IOException, ServletException                              
           {
      
                URLType urlType;
                if(strUrl.equals("CFA")) { urlType = URLType.CHECKFORM; }
      
                switch(urlType) 
                {
                     case CHECKFORMDATA:
                               //do something
                     break;
                }
           }
      }
      .
      .
      The problem is with the switch. Everytime I compile I keep getting the following error:
      urlType might not have been initialized : switch(urlType)