title: Removing negative sign from a string
body: <p>I have to reverse the string a user inputs and I'm trying to remove the negative sign when a user enters a negative number but I'm unsure of how to go about this.</p>
  
  <p>I've tried using string.replace() but I instead of printing for example "9" when a user entered "-9", it would return "99-9"</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Reverse {
  
  public static void main(String[] args) {
      Scanner scnr = new Scanner (System.in);
  
      System.out.println("Type a number: ");
      String num = scnr.nextLine();
      String reverse = "";
  
      for (int i = num.length() - 1; i &gt;= 0; i--) {
          reverse = reverse + num.charAt(i);
  
  
      }
  
      System.out.println("Reverse is: " + reverse);
  
  }
  </code></pre>
  
  <p>}</p>