title: Java how to pass and return string, method?
body: <pre><code>import java.util.Scanner;
  
  import javax.swing.JOptionPane;
  
  public class StarWars { 
  
      public static void main(String[] args) {
          Scanner reader = new Scanner(System.in);
          String firstName = "";
          String lastName = "";
          String maidenName = "";
          String town = "";
  
          System.out.print("What is your first name? ");
          firstName = reader.nextLine();
          System.out.print("What is your last name? ");
          lastName = reader.nextLine();
          System.out.print("What is your mothers maiden name? ");
          maidenName = reader.nextLine();
          System.out.print("What town were you born? ");
          town = reader.nextLine(); 
  
          String Sfirstname = firstName.substring(0,2);
          String Slastname = lastName.substring(0,3);
          String SmaidenName = maidenName.substring(0,2);
          String Stown = town.substring(0,3);
          String Star = Sfirstname + Slastname;
          String War = SmaidenName + Stown; 
          String StarWar = Star + War;
          System.out.print("Your Star Wars name is: " + StarWar);
      }
  
      public static String StarWar (String Star, String War) {
          String name;
          name = Star + " " + War;
          return War;
      }
  }
  </code></pre>
  
  <p>So this is my code about my project. While I'm doing my project I have some problem about the returning method and passing method.</p>
  
  <p>I set up the main method perfectly to print out thing that what I want to see.</p>
  
  <p>The problem is I also have to use passing method and returning method. My teacher want me to do two things with passing/returning method.</p>
  
  <ol>
  <li>Pass all this data to your method, and the method should generate and return the users Star Wars name.</li>
  <li>Get the return value of the method, and display it to the screen.</li>
  </ol>
  
  <p>I have no idea what should I do with this problems (took 5 hrs to do everything I learn but wrong..).</p>
  
  <p>Can someone give a hint or teach me what actually my teacher want me to do and How I can do this?</p>
  
  <p>I really need help from you guys.</p>
  
  <p>Additional, if I run a program it should be like this.</p>
  
  <p>first name? user input: Alice last name? user input:Smith mothers maiden name? user input: Mata town were you born? user input: Sacramento</p>
  
  <p>Your Star Wars name is: SmiAl MaSac</p>