Session getDefaultInstance Example
Session class getDefaultInstance example. This example shows you how to use getDefaultInstance method.
Session class getDefaultInstance example. public static Session getDefaultInstance(Properties props) Get the default Session object. If a default has not yet been setup, a new Session object is created and installed as the default.
Here is the code
/*
* @ # GetDefaultInstance.java
* A class repersenting use to GetDefaultInstance method
* of Session class in javax.mail package
* version 05 July 2008
* author Rose India
*/
package session;
import java.util.*;
import javax.mail.*;
public class GetDefaultInstance {
public static void main(String args[]) throws Exception {
Properties properties = System.getProperties();
Session session = Session.getDefaultInstance(properties);
System.out.println("Debug setting for this Session. " + session.getDebug());
}
} |
Output
| Debug setting for this Session. false |
|