HI, Everyone: I got a strange compiling message, please any expert to explain to me why that. Here is my sample code: import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.io.*; public class DataRetrieval extends HttpServlet { private static Connection con = null; private static Statement stmt = null;
} } And I got error message like: DataRetrieval.java:20: '}' expected. { ^ DataRetrieval.java:22: Statement expected. private String [] TitlePool = new String[10]; ^ DataRetrieval.java:25: Type expected. try ^ 3 errors I thought my code shouldn't have compiling problem so I can't understand the message. Many thanks.
Local variables declared inside a method do not take access modifiers (e.g., "private"). Instead of private String [] TitlePool = new String[10]; private int i = 0; just write String [] TitlePool = new String[10]; int i = 0;
------------------ Phil Hanna Sun Certified Programmer for the Java 2 Platform Author of : JSP: The Complete Reference Instant Java Servlets
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>