I wrote an HttpServlet and I named it "Stick" and then defined a Class named "John" in it. In addition, I wrote another HttpServlet and named it "StickDetails". Both of the Servlets are in the same package.
I want StickDetails servlet to function as a Main function (I want to use the "Stick" class inside it).
The problem starts when I try to write the command in StickDetails "John j = new John;" but john isen't recognized! (""String cannot resolved to a type"")
what did I do wrong here?
Here you see StickDetails servlet:
package wood;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class StickDetails extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException,ServletException {
Stick a; // Stick is not recognized "String cannot resolved to a type"
}
}
I am using Eclipse IDE for java Developers