View Single Post
  #2 (permalink)  
Old 11-16-2007, 03:39 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,266
hardwired is on a distinguished road
Code:
class Pseudo { // member variables // declared in class scope - visible everywhere ... void inSomeMethod() { String the_dir = "c:/test"; postData(the_dir); } private void postData(String filePath) { // This method has access to the local variables // passed in as arguments as well as the member // variables declared in this enclosing class. File folder = new File(filePath); File[] files = folder.listFiles(); for(int j = 0; j < files.length; j++) System.out.printf("files[%d] = %s%n", j, files[j].getName()); } }
For more information see Defining Methods.
Reply With Quote