Top.Mail.Ru
June 16th, 2006 - Java developers — LiveJournal
? ?

Java developers

June 16th, 2006

10:28 am - lemmywinks30 - JavaMail?

I have a java web application and I want to do something basic but I am not sure what is the most simplistic way of doing it.

When a certain field in a table is updated, I want an email to be sent indicating the changes that have been made. The mail recipient will not always be the same. Is this possible? I've been reading about JavaMail but I am not sure what that is all about.

I appreciate any comments you may have. thanks!
 

05:34 pm - curious_tiger - Scanner 101 question

The Java documentation contains this simple Scanner example:
String input = "1 fish 2 fish red fish blue fish";
Scanner s = new Scanner(input).useDelimiter("\\s*fish\\s*");
System.out.println(s.nextInt());
System.out.println(s.nextInt());
System.out.println(s.next());
System.out.println(s.next());
s.close();

I'm having trouble understanding this expression: ("\\s*fish\\s*").
At first I thought this was some type of regular expression, but then I read the next example, which says: " The same output can be generated with this code, which uses a regular expression to parse all four tokens at once," the phrasing of which implies that the above example doesn't use a regular expression.

I'm sorry this is so basic, I just don't understand it from the Java documentation.
1)Does this line actually use a regular expression:
Scanner s = new Scanner(input).useDelimiter("\\s*fish\\s*");
2) If so, could someone tell me how it's read? I know there are tutorials available, but I know if someone could just walk me through this one example, I could pick up the rest on my own. I'm just finding this particular example confusing because I don't understand how that sequence of characters works.

Powered by LiveJournal.com