Define function : Method « JSP « Java






Define function


<%--
  Copyright (c) 2002 by Phil Hanna
  All rights reserved.
  
  You may study, use, modify, and distribute this
  software for any purpose provided that this
  copyright notice appears in all copies.
  
  This software is provided without warranty
  either expressed or implied.
--%>
<%!
   public int sum(int a, int b)
   {
      return a + b;
   }
%>
2 + 2 = <%= sum(2, 2) %>

           
       








Related examples in the same category

1.Passing the out Object to a Method
2.Using Recursion
3.Declaring Multiple Methods
4.Creating a Method
5.Passing Arrays to Methods