• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stanford - Programming Methodology Problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, that's all I need to know! Thanks for the help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic