Java Errs


"illegal modifier for parameter sum; only final is permitted
 
The modifiers private, protected, and public cannot be used on variables inside of a method. This is because you can only have local variables inside of methods. Java is simply telling you that the only modifier allowed at that time is the final keyword.
 
Switch only applies to digit or one-char, not string
 
            ,  Switch           。                 ,              String   ,    JDK1.5    enum,        String    Switch   。     :

   1. enum EnumExample 
   2. {
   3.      Teamreq,Matreq;
   4. }
   5. public class EnumTest {
   6.     public static void main(String[] argc)
   7.     {
   8.         String str = "Matreq";
   9.         EnumExample test = EnumExample.valueOf(str);
  10.         switch (test)
  11.         {
  12.         case Matreq:
  13.             System.out.println("Matreq");
  14.             break;
  15.         case Teamreq:
  16.             System.out.println("Teamreq");
  17.             break;
  18.         default:
  19.             break;
  20.         }
  21.         
  22.     }
  23.
  24. }
  :http://blog.csdn.net/pqw1157/archive/2009/01/06/3721619.aspx