Java Authenticator setDefault() Method

The setDefault() method of Authenticator class sets the authenticator that is used by the networking code when a proxy or an HTTP server asks for authentication.

Syntax:

Parameter:

a - The authenticator to be set. If a is null, then any previously set authenticator is removed.

Return:

The InetAddress of the site requesting for authorization, or null if it is not available.

Throw:

SecurityException

Example 1

Test it Now

Output:

Port info ::-1
URL :null
// source code of https://www.javatpoint.com is printed. 

Example 2

Test it Now

Output:

URL info :null
Protocol:https
// source code of https://www.javatpoint.com is printed. 

Next Topic#




Latest Courses