> <%@ page language="java" %>
> <%@ page import="java.lang.*"%>
These two lines are not necessary. You don't need to specify the language. The package java.lang.*
is implicitly imported, you don't need explicit import statements. This is the very basic of Java programming which every java programmer must be aware of.
> <font size=4 face="verdana" color="#112244>
Font tag is now deprecated. Use CSS instead.
> So what is going wrong?
The error is very clear. When debugging such types of problems, always look at the root cause which has triggered the entire exception chain. The root cause in your case is java.lang.NumberFormatException: null
. This means your parseInt()
method is getting a null which implies that either str1
or str2
is null
.
You will now need to debug your code by either putting a lot of print statements or debugging using an IDE like Eclipse.