2016-12-15 77 views
-1

這是我的代碼在類型prosedure_jsp的方法PRO(INT,INT)不適用於()的參數

<%@ page import="static java.lang.System.out"%> 
<%! 
    void pro(int a, int b) 
    { 
     a = 1; 
     b = 3; 
     int luas; 
     luas = a*b; 

     out.print(a); 
    } 
%> 
<% 
    pro(); 
%> 

和按摩錯誤是:

An error occurred at line: 16 in the jsp file: /prosedure.jsp 
The method pro(int, int) in the type prosedure_jsp is not applicable for the arguments() 

請幫我這個問題。

+4

看來你並沒有真正理解參數的概念。 – Kayaman

回答

2

您試圖調用接收兩個輸入參數(int aint b)的方法,但您沒有傳遞任何東西。

你應該把這樣的事情:

<% 
    pro(5,7);//5 and 7 are just an example 
%> 

而不是你有什麼,你叫pro

+0

我試過你的例子,但屏幕上沒有輸出(空白) –

相關問題