Help coderanch get a
new server
by contributing to the fundraiser

Mike Hudek

Greenhorn
+ Follow
since Dec 31, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mike Hudek

Thanks John, that's a great help.

As you have mentioned, the link you provided it stated that the options -source 1.5 and -target 1.5 are defaults so that is why they are not needed!

A very useful resource for me, that link! Thanks again!

Regards,

Mike

[ February 22, 2006: Message edited by: Mike Hudek ]
[ February 22, 2006: Message edited by: Mike Hudek ]
18 years ago
Hi there,

Peter van der Linden, in his excellent book Just Java 2 6th ed, suggests that, if a program is being compiled which contains features new to JDK 1.5, the command line entry should read something like this:



As an aside, he mentions that this may change after the book has gone to press.

I could not see any indications on his website (or anywhere else) that it has changed, but, as an experiment, I was able to compile some simple programs that contained the new autoboxing and unboxing features (the context in which this issue was introduced) by simply typing



in the command line.

Am I understanding what has been said correctly, and are these extra options on the command line now redundant, or will I have difficulties implementing new JDK 1.5 features at the compile stage in the future?

Where can I find documentation on this?

Thanks for your help in advance.

Regards,

Mike
18 years ago
Thanks Dave!

I've read the Amazon reviews, and it definitely seems interesting! I may very well order it.

Mike
18 years ago
Hi there!

As other posts I have submitted indicate, I love the puzzles that are included in the Head First texts ("fridge magnets", "Be the compiler", "Pool Puzzle")

Are there any other texts available that are littered with challenges and games for programming logic? I'm not just talking about regular tasks/assignments/programming questions, although, if a text includes those together with puzzles and challenges I would sure like to know about them!

It beats Sudoku in my eyes!

Cheers

Mike
18 years ago
Hi there,

I've recently received my brand-spanking-new copy of Head First HTML with CSS and XHTML ... and it is every bit as wonderful as I was hoping it would be! I just love these Head First texts!

Of particular interest, on page iv it lists, in the "Other books in O'Reilly's Head First Series":

Head First PHP &MySQL (2006)
Head First JavaScript (2006)
Head Rush Ajax (2006)[/LIST]

Hmmmm. It doesn't list Head First Objects - one I'm really looking forward to.

But it does list Head First JavaScript - a title that I hadn't had any information about it preparation or imminent release!

Any one out there in the Head First team that can clarify the likely publishing date of these books?

Many thanks!

Kind regards

Mike
18 years ago
Hi Stuart,

Yes, I was wondering about that... but the code structure contained this line so it had to be used to complete the exercise properly.

Personally I find the puzzles in the Head First Java book very satisfying, they often get me testing how well I understand, remember and interpret java notation and code - and I feel that they are a feature of this text that sets it apart from mere reference books.

For example, I just completed (successfully I have to add ) the "A Heap o' Trouble" puzzle at the end of chapter 3, and while I was in the process of figuring it out, I realised I had a major query/confusion regarding the way in which reference variables are created as copies of other existing reference variables in parts of code such as the last line of the following:



So... I wrote a completely different java code that highlighted my confusion, and I included plenty of System.out.print()statements at various stages so I could clearly see what was actually occurring, and what was overwriting what. Suddenly it became far more 'obvious' (dangerous word, I know!) and then I went back to the exercise and sorted it out immediately!

Regards,

Mike
[ January 16, 2006: Message edited by: Mike Hudek ]
18 years ago
Hi Layne,

It's not clear in the book that there are alternative solutions that will give the required print out, so I was wondering if it were intentional, or if there was anything that made the answers in the Head First book 'righter' (or stylistically preferable) to my alternative solution. Maybe others who have worked through this book came up with others?

Regards,

Mike
18 years ago
Hi

I imagine there can be more than one answer... I came up with the following alternative code which seems to do the same sort of thing (anyone else who has worked through this exercise in this book might like to compare!



and the code for the Echo class itself:



This code will still, when compiled and run, give four repeats of the "Helloooo..." and a value of 10 for e2.count at the end of the routine.

Cheers!
18 years ago
Hi again Stuart,

My programming past hasn't been as lofty as yours... just a bit of BASIC programming on first a Sinclair ZX81, and then old BBC Acorn Machines - and now the programmable Texas Instruments TI-83s and TI-84s I use with students - so I have a lot of 'bad habits' ingrained into me from decades past I gotta get out of!

I'll certainly get back once this encapsulation thing is covered and let you know how I'm coping with it.

As a Mathematics teacher, I am well aware of the difficulties of presenting conceptual frameworks - I liken it to being someone helping in the creation a massive tapestry ... but you don't know what the overall picture is. You have to start somewhere, and then you might hop somewhere else, and then a third point, but it is only with persistance and resolve that things start linking together and you begin seeing the overall picture - the real essence of what it is all about.

All the best for now!
[ January 15, 2006: Message edited by: Mike Hudek ]
18 years ago
Hi Stuart!

Thanks for your time and patience to get me thinking OOP! I'm sure I'll struggle with the concepts (and the paradigm shift from my procedural roots) ... but I can clearly see the benefits of the OO approach - and am devoting all my attentions at the moment to wrenching myself into this way of thinking.

OK, so, according to what you have said, it would have been perfectly legit to have written in the code for the GameLauncher class the following:



In this way, the variable game would be set aside without it referring to anything just yet, and its presentation would be similar to the code in the Player class.



was creating an object - an instance of the class 'Player'. Later on in the code we have



and later on



where methods are being applied to the object p1. While it's all fairly rudimentary, I know, I did feel kind of happy that the structure was more according to OOP principles than procedural programming.

Page 39 of Head First Java completed. Another 600 pages or so to go... (Actually I am really enjoying the book! )

Regards for now,
[ January 15, 2006: Message edited by: Mike Hudek ]
18 years ago
Hello again!

I have successfully typed in, compiled and run the guessing game.

However, looking at the code there are a few things I am unsure about . I know that the authors say that not everything should be clear at this stage in the book, but, following my own learning style, I think I'm seeing connections and clarification here would confirm that I'm constructing the ideas correctly!

Here's the code for the three classes: GameLauncher.class, Player.class and GuessGame.class:








Note 1: As I see it here, an instance of the class GuessGame has been created, and it has been given the variable name 'game'.

Note 2: But here, instances of Player called p1, p2 and p3 are simply declared, without yet having been explicitly defined. This only comes at Note 3:

Note 3: Here three instances of the class Player are created and assigned the names p1, p2 and p3.

I replaced the code in the first few lines of the GuessGame code to the following, and re-compiled it, and everything still seemed to work satisfactorily, so I am not sure why the extra code lines included in the Head First Java text were deemed necessary.



I even don't understand why, under the text book version, there is NOT a compile error, as it would seem to me that the statements



are being included before new instances have been created.

Rather confused!

I hope my explanation of an apparent contradiction in my eyes of how instances are declared/defined/created is clear to you!

Mike
[ January 15, 2006: Message edited by: Mike Hudek ]
18 years ago
Hi

Thanks Layne - and everyone else who has been generous with their time on this one. Much appreciated.

Things are actually working - and I am making satisfactory progress.

One more question... Is it necessary to name the .java file the same name as the class that is defined within it?

For example, if, in the java code, I write

18 years ago
Hi

Thanks ever so much for your replies.

I'm getting rather more success now (Had to blow the cobwebs out of my brain and remember how to play around with DOS).

I have adjusted the PATH environmental variable (I'm running Windows XP), and so I am now able to run the javac program to create the classes as I wanted to.

I am still having difficulty actually running the application, though. The path of the java folder is c:\program files\java. In the java folder are two more folders, jdk1.5.0_06 and jre1.5.0_06 . If I type SET CLASSPATH= into the command line then things happen - but this isn't very satisfactory! What should I set the CLASSPATH variable to to ensure that I can always complile the .java program from any directory on my computer (so that the compiled .class file sits in the same directory)?

Thanks again in anticipation.


Mike
18 years ago
Hello there!

I have downloaded and installed the Java 2 Standard Edition development kit, together with the API documentation.

I have now written a small application from the first chapter of the Head First Java book, to basically print something to the command line.

Once I have saved it as a .java file in my computer, how am i supposed to be able to activate the javac.exe program? Do I use the Run from the start menu? I tried that and there was no success.

I'm obviously missing something big-time here!

Thanks in advance,

Mike
18 years ago