Question #246908

Java Class that returns the sum of two integers, write a JSP code that uses a page directives to call this Java Class


Expert's answer

public class Main {
    public static int sum(int a, int b) {
        return a + b;
    }
}


<HTML>
 <HEAD>
  <TITLE>Sum</TITLE>
 </HEAD>
 <BODY>
  Sum is: <%= Main.sum(1,5) %>
 </BODY>
</HTML>
LATEST TUTORIALS
APPROVED BY CLIENTS