| Author |
HFS Doubt
|
Ramesh NarayananPerumal
Greenhorn
Joined: Feb 14, 2006
Posts: 2
|
|
Hi, I am new for JavaRanch and preparing SCWCD.Pl clarify my doubts. In Page 293: <! int doubleCount(){ count = count*2; return count %> <! int count=1; %> It is ok because java accepts forward referncing. but in case of scriplet in page 300 <% int y = 5 + x; %> <% int x = 2; %> They mentioned this won't complie. Why it will not compile? Ramesh.N
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
Declaration of new variables into <%! %> will define the variable as class members. So you can refer to "count" into the "doubleCount" function. However, declarations of new variable into scriplets (<% %> will define+ the variable locally. So you cannot reference x, as long as it has not been declared.
|
[My Blog]
All roads lead to JavaRanch
|
 |
 |
|
|
subject: HFS Doubt
|
|
|