This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
1) Compile time error, an abstract class cannot have non abstract methods. 2) Compile time error, the equals method of the String class takes a String parameter not a StringBuffer 3) Compile time error, class Ilea does not implement the getLeader method of Lcc 4) Compilation and output of "equals" 5) Compilation, but no output at runtime
Sure, there's nothing wrong with any of the code and so it compiles and runs and the comparison fails. A StringBuffer will never equal a String, no matter what the content of each is. That's part of the canonical equals() contract.