Javatpoint Logo
Javatpoint Logo

Java HttpCookie setDomain() Method

The setDomian(String pattern)method of HttpCookie class is used to specify the domain through which the cookie can be presented.

Syntax

Parameter

The above method requires only one parameter:

  1. pattern - which denotes a string which contains the domain name within which the cookie is visible.

Return

N.A.

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.localhost.com
The second domain name is given as: www.google.com 

Example 3

Test it Now

Output:

The domain name is given as:  null 





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA