I am new to java and doing a program which involves use of javax.mail.Authenticator
but I am having trouble understanding a particular statement which is:
Authenticator auth = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
};
I want to know why Authenticator
object created using new
operator also has a body which is overriding a method?
I mean, I have never used or seen this kind of statement, so any kind of hint or reference will help.
Thanks in advance.