• Post Reply Bookmark Topic Watch Topic
  • New Topic

New to programming and trying to learn and stuck!  RSS feed

 
Ryan McKay
Greenhorn
Posts: 8
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone! Nice to meet you all.

I'm new not only to Java but any kind of programming. My end goal is to start writing programs for android and possible branch out to other possibilities as well. After a few recommendations, I went out and bought "Head First Java". So far the book seems great. I'm trying to copy one of the programs in the beginning of the book, but I'm running into some trouble trying to compile it and I can't seem to figure out what the errors mean. Here's the code that is pretty much hand copied from the book.




And here are the errors I'm getting trying to compile it. Can anyone tell me why the errors seem to be centered around random digits? Thanks in advance!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's take the errors one by one.

The first error message says : cannot find symbol class string. This is the hint. In Java, everything is case-sensitive. Lowercase and uppercase really matters. The String class that you are using has to be typed "String", not "string". Correct all occurrences of "string" to "String".

There's another similar error at the bottom : cannot find symbol method Println. Same. The "println" method starts with a "p", not a "P".

So, correct all the lowercase/uppercase errors you can find, and come back when you're done

PS : you can copy/paste text from your command prompt window instead of having to use a picture
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the ranch
 
Ryan McKay
Greenhorn
Posts: 8
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:And welcome to the ranch



Thank you sir! And you were right of course about the errors, but I think you already knew that. I thought that the arrows were pointing to the problem spots but there were in fact not. Thank you so much! My code compiled, and now I have another problem. I'm trying to read into the errors myself and I think it has to do with my java install but I'd like confirmation. When I try to run the code, I receive this in the terminal.

 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to run your code, don't type the ".class".

it should just be:

java PhraseOMatic
 
Ryan McKay
Greenhorn
Posts: 8
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much! It worked!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!