Java HttpCookie getDomain() Method

The getDomain() method of HttpCookie class is invoked to return the domain name set for the given cookie. The general form of the domain is set by RFC 2965.

Syntax

Parameter

N.A.

Return

The above method is used to return a string which contains the domain name.

Example 1

Test it Now

Output:

The domain name is given as: www.google.com

Example 2

Test it Now

Output:

The first domain name is given as: www.google.com
The second domain name is given as: www.javatpoint.com

Example 3

Test it Now

Output:

The domain name is given as:  null




Latest Courses