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.
Output: ---------- Compile ---------- Sub_class.java:8: 'void' type not allowed here System.out.println(Sub_class.return_Number()); ^ Sub_class.java:9: 'void' type not allowed here System.out.println(Super_class.return_Number()); ^ 2 errors Normal Termination Output completed (0 sec consumed).
You're calling PrintStream's println() method and passing in the return value of the return_Number() method. However, the return type of the return_Number() method is void, which is why it's not valid to pass the result of this method as an argument to the println() method - the return_Number() method doesn't yield a return value. [ October 07, 2008: Message edited by: Jelle Klap ]
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.