Java it does not matter. .Net is closely tied into Windows. However I am another Linux fan so there are a --very few -- things to consider:
1. Windows is an insecure OS which is partly as popular as it is because of Microsoft's heavy marketing. It is also focused on Desktops. More and more of the world is accessing computers through smartphones. My sister, who studied Fortran at an Ivy League School learned programming on a machine LESS complicated than even the phones most of the people in the developing world afford. Windows is notoriously resource-heavy. Their smart phone oses are improving but still require more equipment than most people can afford. There are some very good reasons to wonder about the long-term prospects for a .Net developer.
2. Oracle's suit against Google has brought something of a spotlight on the problems Oracle has faced monetizing the assets it bought from Sun (such as Java). Nevertheless the prospects for the skill set look pretty good -- there are reasons to believe that Google might win this suit in which case Java would be less tied to Oracle's IP. Further, Oracle owns a Java for smartphones which some people have called moribund but could very well get a new round of development, which could result in more opportunities for Java developers on more platforms.
3. Further, desktops, like servers and mainframes, are not going to go away. They ARE going to have to be more interoperative though. This is my second reason for discouraging dot Net -- there is a product called Mono from Novell which is supposed to make dot Net products function on UNIX-derived systems (such as Linux) and which from personal experience I can assure you causes a lot of problems because Microsoft and UNIX developers have very different ideas about what a computer is. During the eighties computer science evolved on UNIX, and because it is not so tied to the desktop it remains one of the most lively platforms for development out there -- not only are Linux and Android Unix-derived OSes but Mac OS X and IOS are versions of BSD UNIX. And it is a friendly developers' environment.
4. Your question should be phrased, "what is the best platform that can be used to develop programs?" You will find that you need both OSes and tool chains, which are usually OS independent. .Net is the exception for that. I do not believe you should make it a primary focus, but that certainly doesn't mean you shouldn't have it in your tool kit if you want to develop. You should get over the idea that you will spend your career developing only for desktops. That is not where the field is heading. I would say study Java, and Ruby on Rails and Python. And dot net. Knowing UNIX can be very helpful, but you can develop -- well -- on Windows -- any Windows -- with all of them.