Chuck Lorenz

+ Follow
since Jul 06, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chuck Lorenz

Will you get better results if you replace with ? I don't know from personal experience (too new to the API), but the short course from JGuru on the Fundamentals of the JavaMail API seems to imply it.

The final part of sending a message is to use the Transport class. This class speaks the protocol-specific language for sending the message (usually SMTP). It's an abstract class and works something like Session. You can use the default version of the class by just calling the static send() method:
Or, you can get a specific instance from the session for your protocol, pass along the username and password (blank if unnecessary), send the message, and close the connection:
message.saveChanges(); // implicit with send()
Transport transport = session.getTransport("smtp");
transport.connect(host, username, password);
transport.sendMessage(message, message.getAllRecipients());
This latter way is best when you need to send multiple messages, as it will keep the connection with the mail server active between messages. The basic send() mechanism makes a separate connection to the server for each method call.

22 years ago
I passed today with an 86%.
You haven�t seen my name much in postings around here. I think I�m like many of the anonymous folks who have benefited from searching the postings and from the enthusiasm exhibited in the daily conversations. But I don�t want my thanks to go unheard.
Thank you Java Ranch � sheriffs, bartenders, ranch hands, greenhorns and all you cows that never seem to find your way into the corral.
The advice I found here regarding the exam was right on target. I have nothing to add. The two most important tools for me were JQPlus and JavaRanch � no flattery, just honesty.
Best wishes to you who are still studying, and �Don�t give up!� to you who have to give it another shot. As for me, I�m hooked on the Ranch, so maybe you�ll see my name from time to time.
Thanks again.
22 years ago
Khalid Mughal posted the following on July 09, 2001 in the Programmers Certification Study forum in response to a similar question.
JLS quote:
"An anonymous class is never abstract (� An anonymous class is always an inner class (�8.1.2); it is never static (�8.1.1, �8.5.2). An anonymous class is always implicitly final (�"
If you look carefully you will see that the word "static" refers to the keyword in the above quote. I choose to interpret this as meaning that an anonymous class cannot be declared static (<--- keyword).
In our explanation, we are using the word "static" in the non-keyword sense of the word to indicate "an anonymous class declaration in a static context". As the examples presented in this discussion have shown, an anonymous class declared in a static context cannot access instance members in its enclosing context. This is the point we wanted to get across and the fact that such a class is instantiated without any outer object.
We will make sure that such confusion about terminology does not arise in any future edition of the book.
khalid mughal
22 years ago
Hi Jane,
Thanks for the site reference. I'm fairly new to the Ranch, and this was my first visit to your site. It's great. Well organized; succinct. Very much appreciate your section on And tips and traps!
Thanks for your work.
"value printed on the screen is one more than Integer.MAX_VALUE"
...try interpretting the phrase as
System.out.println((Math.abs(Integer.MAX_VALUE)); + 1
The range of int is -2147483648 to 2147483647.
Notice that the absolute value of Integer.MIN_VALUE is one greater then the absolute value of Integer.MAX_VALUE.
In another(), your comments say that assigning vh to v means v.i == 10 because it references a new Valhold object. Yet back in amethod(), your comments say the System.out.println(v.i) will print "20" due to the changes made in another(). Does not the reference to the new ValHold object supplant the change to 20, so that System.out.println(v.i) should print "10"?