• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stanford - Programming Methodology Problem  RSS feed

 
Rick Maya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I'm trying to learn Java right now by watching the Stanford course video with Mehran Sahami. I'm using both books advised by them: "Karel learns JAVA" and "The Art and Science of JAVA". The problem is that on the 2nd book (The Art and Science of JAVA) some of the codes do not work.
I'm afraid I might be doing something or maybe the source code is out of date. I don't know if it's even possible for the code to be out of date. So what I wanted to know is if the book is still a "good" resource of if I should find something more recent.

I will post one excerpt from the book for those who don't know the course, so you can evaluate the problem:



According to Eclipse, almost every line in this code has a problem. Starting with "import acm.program.*;

Thanks for the help in advance.
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you added the proper JAR files to your build path? Without it, Eclipse cannot find the imported package. Therefore it cannot find class ConsoleProgram, which probably has methods println and readInt which can therefore also not be resolved. Add the JAR file and your code should start working.
 
Rick Maya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just saw on one of the videos that they are using a "special" version of Eclipse with a Stanford tab on the top, perhaps that's why things are not working with me.

They mentioned the "import" subject on one of the lectures but there is no more info about how to load it properly.

I'll try to find more info about that subject. And just to put an end to my doubt: The example code I provided previously is really correct?

Thanks a lot for the fast reply.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have no way of knowing if it's correct; there's nothing fundamentally incorrect about it if you have the appropriate library/libraries.
 
Rick Maya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright, that's all I need to know! Thanks for the help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!