struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From temp temp <miroconn...@yahoo.com>
Subject Simple java question
Date Tue, 14 Nov 2006 20:13:42 GMT
    I declared  a private global field called aField.
      The same  variable I decalred in a method .
                      For example
  public class Test2 {
      private String aField = " aField ";
  
      public static void main(String[] args) {
          Test2 test2 = new Test2();
          test2.testField();
          System.out.println(test2.aField);
      }
  
      private void testField() {
          String aField = "test1";
          System.out.println(aField);
      }
  }
  In the  method testField if I want to access the global variable  aField is it possible
?
          Thanks  & Regards
      Miro
    
 
---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message