Steve Jensen

Ranch Hand
+ Follow
since Sep 23, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steve Jensen

Folks, my wotking directory is C:\java

All my programs are held in sub-directories inside this folder.

For ther code listed below, I created a folder called MyPack, ie


The code below:-

Gives me the following error when I compile it:-": Package C:\Java\MyPack\ stated in source MyPack does not match directory C:\Java\MyPack\ at line 2, column 9

Can anybody explain why? is in the directory structire c:\java\MyPack

Any help is appreciated. Thanks in advance
16 years ago
Hiya folks, well, just like the greatest rock and roll band in the world, ever - The WHO, i'm back, after an almighty almost 3 year absence. Close family bereavments, job changes and site secondments aside, i've decided to wind up the old Java elastic band, and dive back into it. Are the Java tutorials still being done [think i completed the 1 to 99 in words exercise].

I've got back into the books, and am currently on a chapter called "A closer look at classes and methods".

The topic of "Using Objects as Parameters" has just cropped up.

The code i'm slightly confused on, is the following:-

I basically understand what the program is doing, except for the lines

Could someone explain to me what is happening in these 2 lines?

Thanks in advance

16 years ago
Well, i set the properties to the screenshot below (Image 8), and it seems to have solved that problem.

Image 8

But now, when i specify the main class, ie, the class containing the main method (Image 9), i get another error (Image 10) when i try & run it.

PLEASE, i've been struggling to with JBuilder all day, and if i could get this to work, i'd be ever go grateful.

Image 9

Image 10

Folks, i've tried SEVERAL versions of JBuilder, and whatever one i've used, i've had the same problem. It's to do with Packages, ie, declaring and using them.

Ive posted some pictures below, of the folders i have created, what ive done in my JBuilder project setup, and the resuls of trying to compile the code.

Hope it's self-explanatory!

Below is the code for a 'simple' example on Packages, i've copied form a book.

Quite basically, ive created a folder called 'MyPack' on my c:, which has been placed inside a directory on my C: drive called 'Java'. ie. c:\Java\MyPack

Now, when i set up the program from the project properties in JBuilder (see screens (images 3-6), and try compile the program, i get the error stated in image 7.

PLEASE could somebody tell me what i am doing wrong

Cheers in advance!

Image 1

Image 2

Image 3

Image 4

Image 5

Image 6

Image 7

Still don't understand why

ob1.a: is 2

17 years ago
below is a small program which i've lifted from a book (Java 2: The Complete reference, by H. Schildt).

The output generated form the program is as follows:-

ob1.a: 2
ob2.a: 12
ob2.a after second increase: 22


But i have some queries regarding this.

In the line Test ob1 = new Test(2);

If you follow this, surely the first line of the output should be 12, and not 2, i.e., ob1.a: 12

Just how exactly is this program working??

Sory for asking such an obvious question, but i'm racking my brains over this.

Cheers in advance
17 years ago
Hiya folks.

OK, now i understand conceptually, what passing an argument by the "Call by Value" principle is.

But i've been looking at a small program from a book, which is meant to illustrate it. The code is below:-

I sort of understand how this program works, but i am well and truly stumped as to what the line...... doing.

What on earth is 'meth', i.e., this hasn't been declared anywhere else in the code!

Why is this so?

Any help would be greatly appreciated.

Cheers in advance

17 years ago

So what does the line

mean then, i.e., what is o.a (and o.b)
17 years ago
Folks, ive a problem.

Below is a small program i've copied out of a book, designed to illustrate the passing of objects to methods.

What I really don't understand is, in the class 'Test', how do we recognise the 'o' in the lines

What I mean is, I know where the variable 'a' is defined, but NOT the 'o', as on 'o.a'

What's going on here??

Any help would be greatly appreciated

Cheers in advance
17 years ago
Well, "It's been a long time since I rock and rolled", as the song goes. So after a lengthy hiatus, i'm back. Full of cobwebs.

I got as far as completeing and having marked, the 4th (or 5th?) Java assignment.

So i'm trying to pick up where i left off.

Anyway, i've a problem folks, it concerns (I think) the use of the "Return" word.

Below is a short program i've copied out of a book:-

What I don't understand is, in the main class, I call the method "setDim", like so.....

mybox1.setDim(10, 20, 15);

And this method takes 3 parameters, right?

Well, after that, the method "volume" is called on. OK.

From that point on, how do we then manage to arrive back in the main class

Any help would be greatly appreciated. Cheers in advance
17 years ago
I got this messgae 2 mins ago, when replying on a thread:-
Sorry, but the Ranch is quite busy right now. Please try again in a few minutes.
Seems that there are too many cowboys in the corral!!
Thanks to y'all we've raised over $1100 for new hardware! We put in 2 more gigs of memory, an additional CPU, plus a Linux upgrade, so you should NOT be getting this message anymore!. Please let us know if you do see this message.
To see a list of the wonderful people that ponied up a few bucks, take a look at our donations page.
18 years ago
Are you Danish?

As you can probably see from my surname, somebody in my family was!

Don't ask me who though! :roll:
18 years ago
Below is a simple hash map example copied from a text book.
I understand the code, but what i don't follow is, the book says that the letters of the hash map are printed on screen "in the order in which the elements were inserted".
Running the program, i get the output: [D, A, F, C, B, E]
Why is this so?

Also, as a general question, why would we need a hash map??

Any help would be appreciated.

Cheers in advance folks.
18 years ago