Tom Rafferty

Greenhorn
+ Follow
since Apr 16, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Rafferty

I am trying to learn this on my own. I come from a networking background, with very little coding experience, a little HTML and Basic language. I am on chapter 2 classes and objects. As I said originally this may not be an example I was meant to work with.
10 years ago
If I set my name to a variable I could just print the variable.
10 years ago
I see it now. I have a = where it should be a +. Thank you for all your help. It is working fine now.
10 years ago
System.out.println("Tom Rafferty");
10 years ago
Okay that makes sense. If you look at the original file, there are 3 lines that are all basically the same. One for each player. They are all the same except for the individual player distinctions yet only 2 come back with an error.
10 years ago
I want it to print a line that says, Player one guessed, and the number
10 years ago
I also was able to compile the GameLauncher file into a .class file even with the errors.
10 years ago
Kieth Thank you.
I see that now and it took care of 6 of the errors. I still have 2 errors I'll post below.
Jeff thank you I will post with the tags from now on. It is definitely easier to read. I'll also start compiling more frequently.

The errors I have now are:
F:\Workspace\Guessgame>javac GuessGame.java
GuessGame.java:30: error: unexpected type
System.out.println("Player one guessed " = guessp1);
^
required: variable
found: value
GuessGame.java:33: error: unexpected type
System.out.println("Player two guessed " = guessp2);
^
required: variable
found: value
2 errors

I see the marker are in the wrong place here. They should be under the first " on each line.
10 years ago
I am trying to create a program from the Head First Java book. I'm not sure if it was meant to be followed exactly or not. I believe there should be three class files, which I have made and I was able to get on to compile. the other two come back with the same errors.
Here is what I have.
File 1



File 2




File 3, this I was able to compile

I have tried to compile both files 1 and 2. Here are the errors I get with both.

F:\Workspace\Guessgame>javac GuessGame.java
GuessGame.java:2: error: cannot find symbol
Player p1;
^
symbol: class Player
location: class GuessGame
GuessGame.java:3: error: cannot find symbol
Player p2;
^
symbol: class Player
location: class GuessGame
GuessGame.java:4: error: cannot find symbol
Player p3;
^
symbol: class Player
location: class GuessGame
GuessGame.java:7: error: cannot find symbol
p1 = new Player();
^
symbol: class Player
location: class GuessGame
GuessGame.java:8: error: cannot find symbol
p2 = new Player();
^
symbol: class Player
location: class GuessGame
GuessGame.java:9: error: cannot find symbol
p3 = new Player();
^
symbol: class Player
location: class GuessGame
GuessGame.java:30: error: unexpected type
System.out.println("Player one guessed " = guessp1);
^
required: variable
found: value
GuessGame.java:33: error: unexpected type
System.out.println("Player two guessed " = guessp2);
^
required: variable
found: value
8 errors

I have tried everything I can think of, I am very new to this though. I'm quite sure it's something simple I'm doing wrong, or that this example was not meant to actually be run.
Any help will be greatly appreciated.
10 years ago
Thanks a lot. I'm sure I'll have lots more questions as I learn.
10 years ago
I am basically new to coding. I come from a solid networking background. I have some very basic, limited, exposure to HTML and basic language.
I have watched some online tutorials and played with some beginning Java programs, like "Hello World".
A friend suggested I get Head First Java. I was wondering if there was something I should get first? Is that a good starting book?
10 years ago