• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to understand output iterator in static return  RSS feed

 
Gaurav. Prasad
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How does the i & j actually work in static & also with respect to memory space.Can Someone explain?


 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This would work pretty much the same way and might give you a better idea of what's going on:

Line 13 is what I would call "silly stuff you can but shouldn't do in Java" ... if I were in church. Otherwise, it'd be in more language
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the main() method, i and j are local variables. And in the test() method, you have another local variable named i (the argument variable).

The fact that the test() method is static doesn't have any impact on the variables i and j.

Oracle's tutorial page Understanding Class Members explains what 'static' means.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!