diff --git a/src/EMail.java b/src/EMail.java index 0c85ef0..aa09c42 100644 --- a/src/EMail.java +++ b/src/EMail.java @@ -6,7 +6,7 @@ public class EMail { * @param email The email address being checked * @return true if the email is correctly formatted, otherwise false */ - public boolean validate(String email) { + public static boolean validate(String email) { // Set up regex for email format String emailRegex = "[^@ \\t\\r\\n]+@[^@ \\t\\r\\n]+\\.[^@ \\t\\r\\n]+"; Pattern pattern = Pattern.compile(emailRegex); @@ -20,7 +20,7 @@ public class EMail { * @param email A valid email address * @return The domain of the email address from the parameter */ - public String getDomain(String email) { + public static String getDomain(String email) { // Checks that the email address is valid, otherwise throw exception if (!validate(email)) { throw new IllegalArgumentException("The email address provided is not valid"); diff --git a/src/ReadFile.java b/src/ReadFile.java index eb86761..3391de3 100644 --- a/src/ReadFile.java +++ b/src/ReadFile.java @@ -10,7 +10,7 @@ public class ReadFile { * @param filename the name of the file with, only allowing a .txt extension * @return The contents of the file */ - public List open(String filename) { + public static List open(String filename) { // Check that the filetype is correct, otherwise, throw IllegalArgumentException if (!filename.endsWith(".txt")) { throw new IllegalArgumentException("The filename is not a .txt format");