This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi everyone! I have just registered here. Thanks in advance!
I am having probably a very basic problem, but I can't figure it out myself.
I am trying to learn Java, I got a lot of material about it, but the java they teach are of different versions. I am running Java 6 using Eclipse, and sometimes I get stuck in a very simple exercise like HelloWord or Add2Integers...
I am trying to run an Add2Integers program, but I can't "import acm.program.*" or extend "ConsoleProgram" as the book says, also the "readInt " does not work, where says "println" only works if I use "System.out.println".
I have searched on the java website the syntax changes between the version, or what have changed between the versions, I couldn’t find anything to clarify. One of the videos I downloaded says that using a different version is not a big deal, but it is since I can’t run a simple exercise.
It is probably very simple for who knows, but it is getting me frustrated!
Java 6 is the latest version of Java and it is backwards compatible, so any standard Java stuff in your teaching materials should work.
Your problem is that the acm.program package and the ConsoleProgram class are not part of standard Java. They are probably in a third party jar file that you need to include in your classpath when compiling or running your program. Either your teachers or the teaching materials should tell you how to get hold of this jar file.