Created
April 18, 2018 01:12
-
-
Save anthonyjdella/553f543223010e0b073b63caf92f297d to your computer and use it in GitHub Desktop.
Java without Magic Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MagicNumber { | |
String pipeDelimitedString = "This|is|an|example|of|Magic|Numbers|123 Parker Road|cityline@gmail.com"; | |
String [] splitString = pipeDelimitedString.split("\\|"); | |
obj.doSomething(splitString[Constants.HOME_ADDRESS]); | |
obj.doSomething(splitString[Constants.EMAIL_ADDRESS]); | |
} | |
class Constants { | |
public static final int HOME_ADDRESS = 7; | |
public static final int EMAIL_ADDRESS = 8; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment