Al Fraelich

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

Recent posts by Al Fraelich

Hello everyone,
I've been away for quite a while completing the demanding workload for a BS and MS (1 class left) in CS. Now I figure I should learn how to actually program ;p

let's have some fun!

Al
5 years ago
Just submitted assignment Java 2 EvenOrOdd.

-Al-
11 years ago
What is a reasonable wait time from my nitpicker? I don't want to be a pest, but I've been waiting a couple months. I understand everyone is busy and I don't want to complain. I only want to know if I can move on to the next project is all.

Thanks,
Al
11 years ago

program files\java\jre6\bin



The JRE doesn't have the files you need. You need to point your path to the \bin of the "JDK".
probably something like this.. " C:\Program Files\Java\jdk1.6.0_21\bin "
If you haven't installed it, you can get it from sun, if you have, just change your path to that bin and you should be good.

Let us know if that doesn't work.

Al
14 years ago
This is a common mistake for people just starting out. It usually results from typing the first letter of the file then hitting tab and letting the cmd fill in the rest, which includes the .class at the end. To make it work, don't put the .class on the end of the file for example

DON'T java HelloWorld.class

DO java HelloWorld

subtle difference, thats it.

Good luck, and welcome to Java!

Al
14 years ago
reading through the API, I understand that it's certain things that are "static final" for example, number of months or names of months or number of days in a particular month. they don't want you adding the 45th of septober or something like that. Things that will never change, are best kept as "static final", speed of light, feet in a mile, JavaRanch's awesomeness and so on.

Hope that helps,
Al
14 years ago
Alright Eric, I know where you are, and I've been there. there are all kinds of "directions" but very few offering an "understanding". I'm going to try to do that here.

Alright, from here I am only speaking in specifics of using notepad to write the program and the command prompt to compile and run it.

writing a "hello world" program (you can find it anywhere) in notepad and saving it as a .java file anywhere (on your desktop is fine for now).
Open command prompt and change directories to your desktop probably something like "cd Desktop" should do it.
type "javac HelloWorld.java" (or whatever you named the file/program). javac is the compiler, it will compile the .java file and create a .class file. this will only work if path is set correctly. if you recieve an error 'javac' is not recognized as an ... then your path is not set correctly for javac. To set it, go to start -> right click "computer" -> properties. on the left side of the window select advanced system settings (windows 7). Another window opens, select "Environment Variables" button on bottom. New window opens, in the top half, select "path" then press the "edit" button. At the end of the list, add a semicolon " ; " and for me, I added "C:\Program Files\Java\jdk1.6.0_21\bin" This points to the folder where windows can find the "javac" executible. save changes, and try to compile same as before. If it works correctly, it will create on the desktop (same directory as the source file) another file named the same but it will be a .class file. Your path for the compiler is now set.

Now to run the file all you need to type is "java HelloWorld" do NOT add the .class to the end or you will receive errors.

where ever you decide to put the source file, you should be good.

Hope this helps
Al
14 years ago
Did you get it working Eric? or were you just looking for an explanation?


Al
14 years ago
Ben, the "return" is used to get the result of a method.
In it's simpilist form, you could have a method that let's say adds 2 to a number entered by the user. Of course something this simple could be done in the "main" method of the code, but as your programs get larger, you will want the "main" to be as concise and small as possible. So you will keep the methods seperate, and call them from the "main". Because methods are kept seperate from the main, you may need to "return" the result.

Al
14 years ago
think of test as an object, like a ford, mustang. there are many "instances" of ford, mustang in the world. But each is "unique".

You identify each "unique" instance of ford, mustang by a vin number, where as in java each instance of an object is identified by a name.

In your example, one instance of Test was named "test" and the other instance was named "test2", if I remember correctly.

so test is a completley different, but identical, instance of test2.

Hope that helps
Al
14 years ago
Here is what I'm working on;

http://highered.mcgraw-hill.com/sites/0073047023/student_view0/project_assignments.html

It is a list of projects that start at the very beginning of programming through to the beginnings of programming with Java GUI. I used this book with my first two programming courses and have gone back to the beginning and started reprogramming them all in GUI.
The book is AWESOME! I use it more than Head First Java(HFJ), because I prefer the straight forward explanations and examples, but it does not seem to go as deep as HFJ does.

regardless the examples are universal, and when the Air Force allows me more personal time I intend on signing up for the cattledrive!

Hope these posts have helped you!
Al
14 years ago
I found the one I was thinking of
http://mindprod.com/project/projects.html
Have fun!
14 years ago
here is a pretty awesome list of ideas, I recall another one and will keep looking for it for you and will post it after I find it.

http://www.dreamincode.net/forums/showtopic78802.htm

This is a pretty extensive list for now though.
14 years ago
I will explain how I it was explained to me. Making anything "private" means it is only available from within the class it was defined, "static" makes that variable available from ANYWHERE in that class, and "final" does not allow that variable to be changed, adding the modifier "final" changes your "variable" to a "constant" due to it's constant value instead of variable value.

for example, when working with constants like the speed of light or conversions (12" = 1') you want to create "constants" as to prevent errors.

private static final double SPEED_OF_LIGHT = 299792458.0 // meters/sec

means that it is only available from within the class but static makes it available ANYWHERE within the class and final prevents unintended changes to the constant.
That is my understanding, and I hope it helps.

Al
14 years ago
Unfortunatley I am learning this on my own. I have had two programming classes so far, both in java, but I did not learn GUI until the last week of the second course and we only used a couple JButtons and JFrame. I have been trying to continue on my own but if it wasn't used in my class, I don't really know about it. I have been to the the API site (also downloaded it) but navigating it for what might be a better way of doing it is at times, confusing. But any suggestions I get, I will immediatley attempt to incorporate them in my programming. The only one I have not, as of yet, been able to use is the "button.removeListener()" method. I am not sure why, but I believe it's because I am trying to remove it from within that actual listener() and I am not sure if that is possible, but I will try you suggestion right away, Thank you for your response!

Thank you all for your input

Al Fraelich
14 years ago