• Post Reply Bookmark Topic Watch Topic
  • New Topic

Questions about learning java from no experience what so ever.  RSS feed

 
sean parsons
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im currently reading the book by Kathy Sierra and Bert Bates Head First Java and i was wondering that as a complete newbie is it normal to not understand somethings? Or should i get the concept immediatly? Or does it require some hand on experience to see exacty how it works? help please?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it is normal. I still go back and re-read some of my old books to pick up what i missed on the first dozen readings.

Experience is always a good thing...start writing your own code ASAP. experiment. try stuff and see what works (and what doesn't). it's really the only way to learn.
 
sean parsons
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if im not fluent enough in the language to write my own code, i don't even know where to begin and everytime i try to write something; Java can't complie it and run it. What should i do to get Java savvy?
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you need to learn programming, not Java.

Doing this without someone guiding you is ... hard. Read several different (introductory) books and tutorials, work through different books, use different languages. There will be no silver bullet, for different aspects different courses and materials will be helpful (for you).

Try to find someone who can help you with the initial steps. While this may work online and with books alone, someone looking over your shoulder whom you can ask when you are stuck is way better. Maybe public courses at a nearby university (community college courses vary vastly in quality; I would not recommend to visit one without knowing about the quality).
 
sean parsons
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for both of your feedback. I am trying to learn very hard and it's not too difficult but theres just somethings i don't understand that i feel the book thinks i understand.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sean parsons wrote:What if im not fluent enough in the language to write my own code, i don't even know where to begin and everytime i try to write something; Java can't complie it and run it. What should i do to get Java savvy?

To start, you do nothing more than copy other people's code. and I mean type it character by character, not cut-n-paste.

ask questions - that's why we're here.

when you say "Java can't compile and run it", you're not telling us anything. Do you take your car to the mechanic and say "my car doesn't work"? Or do you say "when I drive at speeds between 50 and 55 m.p.h., the car shakes and it feels like it's coming from the left front tire"?

you have to tell us the details. tell us the EXACT error message. Tell us EXACTLY what you are typing to run the compiler or JVM. Post your source code EXACTLY as you wrote it so we can look at it.

People here want to help. they enjoy it. they will bend over backwards to help you. But you have to do your part to and make it possible for us to help you. I can think of about 10 different things that could be the reason 'java can't compile and run it', and the fix is different for each one.
 
john sayeau
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As somebody who decided to go from fixing hardware to learning how to program, I fee your pain. I went through the same Head first java book and eventually I started to feel like I'm getting it. You have to put in lots of time, experiment with the ideas presented in whatever you read, and as Hauke Ingmar Schmidt said
work through different books, use different languages


I did this, and it really helps. I read a book on Objective-c and another on C# and found that if I didn't understand one book's description of an oo concept, reading another one often gave me a better understanding of the idea. Above all, it just takes hours of focused work.

just another beginner's opinion.
 
alex lesta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sean parsons wrote:Thank you so much for both of your feedback. I am trying to learn very hard and it's not too difficult but theres just somethings i don't understand that i feel the book thinks i understand.


@ Sean i feel the same your not the only one. I am reading the same book. There are something i just dont understand. But i am hanging in there. I am determine to learn Java.
 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
sean parsons
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:
sean parsons wrote:What if im not fluent enough in the language to write my own code, i don't even know where to begin and everytime i try to write something; Java can't complie it and run it. What should i do to get Java savvy?

To start, you do nothing more than copy other people's code. and I mean type it character by character, not cut-n-paste.

ask questions - that's why we're here.

when you say "Java can't compile and run it", you're not telling us anything. Do you take your car to the mechanic and say "my car doesn't work"? Or do you say "when I drive at speeds between 50 and 55 m.p.h., the car shakes and it feels like it's coming from the left front tire"?

you have to tell us the details. tell us the EXACT error message. Tell us EXACTLY what you are typing to run the compiler or JVM. Post your source code EXACTLY as you wrote it so we can look at it.

People here want to help. they enjoy it. they will bend over backwards to help you. But you have to do your part to and make it possible for us to help you. I can think of about 10 different things that could be the reason 'java can't compile and run it', and the fix is different for each one.


Im using a code given to me in the Head First book for a simple game application and i get 2 errors on the entire code, one of them is public void startGame(); keeps saying that theres something wrong with void it says exactly this "Syntax error on token "void", @ expected" and it keeps giving me errord on making Player into p1,p2,p3 stuff so when i type Player1 = new player; then i try to convert player1 = p1 it gives me a hard time and then when i try to give p1 a method. Like p1.guess(); it doesn't accept p1 as a player class and it tries to make me create a new classfor p1 when i have a player class created allready but i have't gave it inherited instance variables or methods can that be a problem?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16058
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you've copied example code right from the book, it should compile. You probably have some subtle mistake, like a missing } or ;. So, look carefully if the code that you have on your computer is exactly the code that's in the book.

Go slowly, and try to understand exactly what each line of code, and each element in the code means. Read the error messages from the compiler carefully and try to reason about what it's trying to tell you. And if you have specific questions, just ask them here!
 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young wrote: . . . Go slowly . . .
Agree. Write 5 lines, compile, run, then write another 5 lines. Don't try writing lots of code at once.
 
sean parsons
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I select run does it automatically complie the code for me or do I have to do that before I click run?
 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using the command line, you have to use the "javac" tool first. Beware: if you get an error the second time you compile, and try to run the application, the old versions of the .class files will still be in your directory and those will be executed.
 
Adeiza Yusuf
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its really interesting to see others go through what you have gone thru and probably still going through, On my shelf, am sure i have all the available java books that have been sold right from Stevel Holzner's JAVA Blackbook, deitel, bruceekel, murach to name a few. though i didnt have much time for them at the time because i was working and just retired. but when am on vacations i took time to read them yet after 10 years i still didn't get the grasp, but guess WHAT? I was impatient!

I didn't take my time to learn the language basics which for me (personal opinion) is Object Orientation Principles, so after I retired i decided that even though i didn't know the language i am going to buy one LAST book and take the java certification even if i don't pass it once. So I ordered for a book solely to prepare me for the certification and believe me, this is where i reach the light at the end of the tunnel. based on recommendations I bought SCJP study guide by Kathy Sierra and Bert Bates, This book aside leading me to this wonderful JAVARANCH.com, I must confess after 10 years has finally revealed JAVA to me like to other, It gave me the confidence i needed and now i used this book as my main javabook and use the others and internet as references. I learnt the Basics of java from this study guide..

to add to what other great programmers have added I advice you concentrate more on the OOP basics. then the SCJP certification.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sean parsons wrote:Im using a code given to me in the Head First book for a simple game application and i get 2 errors on the entire code, one of them is public void startGame(); keeps saying that theres something wrong with void it says exactly this "Syntax error on token "void", @ expected" and it keeps giving me errord on making Player into p1,p2,p3 stuff so when i type Player1 = new player; then i try to convert player1 = p1 it gives me a hard time and then when i try to give p1 a method. Like p1.guess(); it doesn't accept p1 as a player class and it tries to make me create a new classfor p1 when i have a player class created allready but i have't gave it inherited instance variables or methods can that be a problem?


Again, you're not telling us the details.

Are you using an IDE like Netbeans, or are you compiling from the command line?

saying "i'm using code given to me in the Head First book" is still meaningless. I've read that book. There are hundreds of code examples in there. We have no way to know which one you are trying to use. Post your code here, exactly as you have it written. The error message should tell you the exact line, and often the exact character where it thinks the error is.

If you have a line that says EXACTLY this:

There are several things potentially wrong here.
1) Is Player1 already declared?
2) Class names should start with a capital letter, so it should probably be

3) After the word 'new', you are generally calling a constructor, which is like a method, so it should again probably be


I'm not sure what you mean by "convert player1 = p1"

What is player1? Is that supposed to be Player1? (Java is case sensitive, so it does NOT see player1 as the same thing as Player1).
What is p1? Where did that come from? And what do you mean by 'convert'?



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!