Skip to content

Tag: java

Session created by Tomcat

I am learning session with servlets and i read in the book that to create a session we need to call as below. HttpSession session = request.getSession() This causes the web container to create a session ID and send it back to client so that client can attach it with every subsequent request to the server. Whe…

Constant expression required in Java switch statement

I have ths piece of code in Java but I have this compilation error: Constant expression required Answer The error tells you exactly what is wrong. Case labels must be compile-time constants. This: has a method call, which is not known at compile time (according to the rules for determining what is constant). …