The first one prints the ID of the Calendar's timezone. You have set that to a particular timezone.
The second one prints a Date, not a Calendar. And since a Date doesn't have a timezone, what you see there is your default timezone. Presumably that's not the one you used when you set the Calendar's timezone.
The second one prints a Date, not a Calendar. And since a Date doesn't have a timezone, what you see there is your default timezone. Presumably that's not the one you used when you set the Calendar's timezone.
So this prints default timezone (IST) but this calendar object sets to EST time zone. It is a kind of misleading information.
The documentation for those classes isn't misleading at all. You've highlighted something which beginners frequently stumble over, but if you look at the code and read the documentation for the classes and methods you used, you'll see how it works. You should try that. I strongly recommend it.
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
a bit of art, as a gift, the permaculture playing cards