Skip to content

Instantly share code, notes, and snippets.

@fado
Created October 20, 2013 13:39
Show Gist options
  • Save fado/7069798 to your computer and use it in GitHub Desktop.
Save fado/7069798 to your computer and use it in GitHub Desktop.
package uk.ac.qub.programming;
import java.util.Scanner;
public class Obfuscate {
public static void main(String[] args) {
String userInput = "";
String output = "";
Scanner input = new Scanner(System.in);
System.out.println("Enter your name: ");
userInput = input.nextLine();
for (int counter = 0; counter < userInput.length(); counter++) {
if (userInput.charAt(counter) == ' ') {
output += " ";
} else {
output += "*";
}
}
System.out.println(output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment