The Supreme Court's decision
What exactly did the court say? The ruling itself was very narrow. The dispute was over code that defines an API, which constituted a mere 0.4% of Java's source code. The court made a strong distinction between interface declarations and the implementation code, so the ruling has no impact on the vast majority of software code out there. Furthermore, they declined to rule if interface code is copyrightable; instead, they invoked the fair use doctrine.
They were cautious in how they applied fair use, noting that Android is not a competing substitute for Oracle's Java SE and that Oracle may have even benefited from Android increasing Java's overall popularity as a language. What we find particularly interesting, though, is that the court distinguished software from other copyrightable media. It noted that computer code, unlike books and movies, has a functional purpose that creates a public interest unique from all other copyrightable media. This allowed the court to define a fair use precedent for computer code that seems to be more lenient than other media (although you should consult your local legal scholar to weigh in on the intricacies of those differences).
The court also noted that copyright protects expressions of idea but not the ideas themselves. Patents, in contrast, protect ideas -- but Oracle's patent claims had been rejected by lower courts long before it reached the Supreme Court. The court correctly distinguished between interfaces and the code implementation behind the interface. An interface definition is merely an idea of what the computer could do while the implementation code is the expression of that idea.
An analogy would be if