title: returning string in method and changing the global variable
body: <p>What im doing is trying to change the variable postFix from the method append.... but am having no luck... at the end of my main method i have a print and at the end of my append method i have a print... and when i run the program they do not match.... and the program is completely by passing what im attempting to do in append. why is this? is it because im returning it to a method and not main?</p>
  
  <pre><code>//MAIN 
      public class stack{
          public static void main(String[] args) throws Exception{
  
  String line = null;
  String postFix = "";
  int valOfStack = 0;
  int icp,isp = 0;
  BufferedReader in = new BufferedReader(new FileReader("p4a.dat"));
      char[] array;   
      array = new char[100];
      line = in.readLine();
      System.out.println("infix: "+line);
      int length = line.length();
          System.out.println("length: "+length);
           //char num = line.charAt(0);
      Stack stack = new Stack();
          //stack.push(num);
          //System.out.println(stack.top());
  </code></pre>
  
  <p>........   continued</p>
  
  <pre><code>  else if(word.contains("+")){
                    System.out.println("ya we in// charAt - "+i);
                        operatorJob(word,stack,valOfStack,postFix);
  
                }
  
                else if(word.contains("*")){
                    System.out.println("ya we in// charAt - "+i);
                  operatorJob(word,stack,valOfStack,postFix);
  
                }
  
                    else if(word.contains("/")){
                    System.out.println("ya we in// charAt - "+i);
                  operatorJob(word,stack,valOfStack,postFix);
  
                }
  
               else if(word.contains("^")){
                    System.out.println("ya we in// charAt - "+i);
                  operatorJob(word,stack,valOfStack,postFix);
  
                }
  
  //OPERATOR JOB
      public static int operatorJob(String word,Stack stack,int valOfStack,String postFix){
          //if word is an operator +-*/^or(
  
                  if(stack.isEmpty()){
                      stack.push(word);
                  valOfStack+=1;
                  }
  
                  else{
                  String inStack =stack.top().toString();
                  int isp = assignISPval(inStack);
                  int icp = assignICPval(word);
                  System.out.println(icp+" "+isp);
                      if(isp &gt;= icp)
                      append(postFix,stack);
  
                  }
  //METHOD THAT IS RETURNING
  public static String append(String postFix,Stack stack){
                      String operator = stack.pop().toString();
                      postFix = postFix.concat(operator);
                      System.out.println("a "+postFix);
                          return postFix;     
                  }//end append
  </code></pre>