Showing posts with label exercises. Show all posts
Showing posts with label exercises. Show all posts

Good or Great

I have finished reading the chapter on arrays in Java. This is for my college class. In addition to the reading, I have completed each Self-Test question from the chapter. I have written Java programs to solve all the exercises at the end of the chapter. You could say that I have achieved a good understanding of the material.

Here comes the hard part. There are also a bunch of programming projects at the end of the chapter. However there are so many other things I would rather be doing. We are behind at work. I could catch up with this week's list of tasks to be completed. It is nice outside. I can do some necessary yard work. The weather also lends itself to me taking a bike ride with friends. The girlfriend wants to see a bunch of movies. She is also hungry and wants to go out to eat.

It is easy in the middle of the night to spend some time learning Java. The hard part is now when I really don't want to do any more Java programming. After all, I have reached a good enough level of understanding. What is there to gain by going further? The answer is that there is greatness to be attained. Now I am not saying that I will be a great Java developer. But in order to have a chance at greatness, I must push on now. It is absolutely required to do each and every one of the programming projects in the back of the book.

To tell the truth, greatness will also require going beyond the projects in the book. I need to code up some other programs using Java. You know. I need to implement some non trivial application using the Java programming language. Only then will I have a slight chance at possessing great Java programming skills. Let's see where this takes me.

Setting the CLASSPATH

I continue to read ahead in my Java class textbook. Reading alone does not make the concepts sink in. So I try to do each and every exercise in the book. Today I had some free time at work. I decided to try one of the exercises from the section I was reading. The exercise instructed me to use a class that had a source listing in the book.

My instructor provided me with the source code for the listings in the book. This helped so I did not need to type in the code. I compiled the class provided to me by the book. Then I coded up a simple second class in another file which made use of the class from the book. However the Java compiler complained that it did not know the other class name.

This was very strange. I had already compiled the other class. Everything was in the same directory. I was at a loss. I tried to import the other class. That did not work. The other class was not in a package. I could have sworn that this worked before. If the other class is in the same directory you can use it.

Then it dawned on my. I bet there was something wrong with the CLASSPATH. I checked out the system variables and found that the current directory (.) was not a part of the CLASSPATH. I quickly added it to the beginning of the CLASSPATH. Now this makes sense. Java won’t consider code in the current directory unless that directory is part of the CLASSPATH.