Japan is prepared for self defense as that's all they can prepare for since they are prohibited from invading any country. I believe that they could repel a German invasion but I see no reason Germany would want to invade Japan as they are currently major trading partners.
Japan doesn't have an official military, as it is prohibited by the Japanese constitution. Obviously, the country with a military will win a war.
Germany is larger and more pre-paired
Germany has a bigger and stronger military but not by much so it would be close but I'd say Germany.
This would never happen, but Germany would.
Let's not forget the fact Germans are a highly tuned war machine. LOL