Java Authenticator getRequestingPort() Method

The getRequestingPort() method of Authenticator class is used to get the port number for the requested connection.

Syntax:

Parameter:

No parameter is passed.

Return:

An integer indicating the port for the requested connection.

Throw:

Does not throw an Exception

Example 1

Test it Now

Output:

Host using url.getHost ::www.javaTpoint.com
Port Requesting :8080
//source code of https://www.javatpoint.com is printed

Example 2

Test it Now

Output:

Portname:8080
//source code of https://www.javatpoint.com is printed. 





Latest Courses