title: How to return string with error "void method cannot return a value"?
body: <p>I turned a codingbat warmup exercise into a program on Eclipse. The exercise calls to take the last char of a word and tack it onto both the front and end of a word, e.g. "cat" → "tcatt."</p>
  
  <p><strong>First attempt:</strong> </p>
  
  <p>I started with this set of code and received the error "void methods cannot return a value." After some research, it appears that it's simply that if there's only one main method, you cannot return a value.</p>
  
  <pre><code>Scanner input = new Scanner(System.in);
  
  System.out.println("Enter a word: ");
  
  String str = input.nextLine(); // user input
  
  String last = str.substring(str.length() - 1);
  return last + str + last;
  </code></pre>
  
  <p><strong>Second Attempt:</strong></p>
  
  <p>I tried here adding a second method and renaming the second string at the bottom to str1, to correct a duplicate local variable error:</p>
  
  <pre><code>public static void main(String[] args) {
  
  }
  
  public String backAround(String str) {
  
      Scanner input = new Scanner(System.in);
  
      System.out.println("Enter a word: ");
  
      String str1 = input.nextLine(); //user input
  
      String last = str1.substring(str.length() - 1);
      return last + str1 + last;
  </code></pre>
  
  <p>This code now displays no errors, but won't display anything and thus won't take any user input. What is the methodology to correctly get the user input and return the string?</p>