.NET compiles for Win32 (32 bit) by default, even if the operating system is a 64 bit version. So no problem on this. If you compile for x64 you will be able to exchange your code, but your binaries will only run on a 64 bit installation. Even so, unlikely C/C++, a source code can easily be compiled for both Win32 and x64 with no changes.
The same goes for Java, 2 different versions of the JVM exist, for 32 and 64 bit Windows. You can install both of them without any issue. If you want to code 32 bit applications, you have to install a 32 bit JDK. You might experience some minor issues with the IDEs, so maybe you'll need to download both JDKs, but your code will be portable anyway.
EDIT
I don't know what kind of issued I was remembering.
As it was said in the comments, .NET and Java are compiled to platform-neutral bytecode, which means that not only the source code, but also the compiled binaries, can be shared among different platforms (x64 or x86).
If you are using native code, or third-party libraries that use platform-specific native code, it might be more complicated, because you have to deploy the native code compiled for the right architecture.