0

Hi all ,

Good Day!

I am having confusion in storing null values in hashmap and passing null in println method.

1) When I add null value in hash map directly it will not allow at the same time when I assign a null value in to string and add that string in to hash map it allows once. how its working.

2) Similarly how null printing when pass null in println method.

Pls clearify me.Thanks in advance.

3
Contributors
2
Replies
16
Views
2 Years
Discussion Span
Last Post by Taywin
1

1) When I add null value in hash map directly it will not allow at the same time when I assign a null value in to string and add that string in to hash map it allows once. how its working.

There shouldn't be a problem adding null value directly to a HashMap variable. How did you declare your variable? What are 2 types you assigned to the HashMap?

2) Similarly how null printing when pass null in println method.

You simply use System.out.println() method. It should display null string as the display.

Edited by Taywin

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.