The 5 Main Causes of World War I
Assassination of Archduke Ferdinand
Assassination of Archduke Franz Ferdinand
Countries would try to extend all power through military and diplomacy force, so they would attack other countries to send a message that "We're the best country and you better stay away and not fight," or something like that.
Nationalism is political independence, so they don't have any allies. With no allies, the country is weak. That makes them an easy target for war, because they only have their own country to back them up and no one else. Everyone needs allies, no matter the military strength, country size, or government strength.
Militarism could be based on imperialism a little bit. The cartoon to the left basically says that terrorists are not allowed to kill people, but the military would be [but would have to declare war]. If you think about it, both scenarios have the death of people and random acts of war or terror. Point made.