bob towers

Ranch Hand
+ Follow
since May 20, 2002
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 bob towers

Thanks everybody, this has been both interesting and useful. The discussion raises other questions, like whether vectors are similarly limited (i suspect they are), and how we might get round this limitation. The array of arrays idea mentioned above sounds promising... it leaves me wondering whether multidimensional arrays are actually implemented by dividing up the capacity of a single array or whether they are implemented as an array of arrays.
If anybody happens to know the answer to this then do please let me know.
thanks again everybody.
best wishes
bob_towers@hotmail.com
Let's say it's an integer, then persumably that means you can have only 2 to power of 32 elements. Okay, let's say it's a long, then we can have 2 to the power of 64 elements. Agreed? But what this means is that an array is limited in the number of elements it can hold. So the size of an array *is not* limited by the size of the file system.
Does anybody know what type the length instance variable of an array is?
cheers
bob
I presume you mean:
b1.booleanValue() && b2.booleanValue();
regs
bob
Okay, so you're saying you *do* get some kind of documentation to prove your scjp percentage score.
okay thanks for this
regs
bob_towers@hotmail.com
19 years ago
So basically you'd have to do a screen scrape of that information.... or perhaps give your prospective employer the details of your log for the certification results site?
bob
19 years ago
Just out of interest why is java ranch so strict about this naming policy? Surely it does no harm to allow users to have a single word for their 'identity' here?
bob
I've read some bartenders/ranch hands etc. suggest that it was no surprise that AWT was cut from the new exam.....
but why is it no surprise?
What complaints/criticisms were levelled against the AWT section?
Do please let me know.
regards
bob_towers@hotmail.com
but if i wanted to, how could I ?
(don't all speak at once now...)
bob_towers@hotmail.com
Let's imagine you work really, really hard and get a score of 95%, or 98% ... or even 100%.
Then later, being proud of your results you put your percentage score on your CV (or resume). So my question is this: Do you get any kind of documentation, or receipt, or on-line 'results' bulletin board, which you can use to prove that you got the percentage score that you claim on your CV (or resume) ?
If anyone knows the answer to this question it will be you guys in this forum.
congratualations on passing by the way ! :-)
best regards
bob_towers@hotmail.com
19 years ago
Sorry, i'm having keyboard problems, i'll try again:
This is a really nice question there are two versions of it:
VERION A:
public static void change_i(int i[]) {
int j[] = {2};
i = j;
}
and
VERSION B:
public static void change_i(int i[]) {
i[0] = 2;
i[0] *= 2;
}
In version A you pass a copy of a reference to an array. Within the method body you change the value of *THE COPY* but you do not change the value of any of the contents of the *ORIGINAL* array.
In version B you use the copy of the reference of the array to address its *CONTENTS* and change their value.
If i'm not mistaken you found this question on javaprepare's site. I think these versions neatly delineate the distinction between a reference to an array and referencing the contents of the array..... or at least, i found it useful.
best wishes
bob_towers@hotmail.com
This is a really nice question there are two versions of it:
public static void change_i(int i[]) {
int j[] = {2}; i = j; }
I might just add however, that if encounter the question: How many bits are in a boolean ? I am still no nearer being able to supply a single answer... with this extra knowledge (as above) i am able to provide *more*, not *less*, competing answers than i could before.
Can anyone tell me whether a question about the size of a boolean has ever, will ever, come up in the exam ?
best wishes
bob_towers@hotmail.com
Thanks for the link and the tip Jessica, much appreciated.
For those readers curious as to the detailed answer to this question here is a post, over two years old, which quite a definitive response:
Check out this quote from the Java Virtual Machine Specification:
Although the Java virtual machine defines a boolean type, it only provides very limited support for it. There are no Java virtual machine instructions solely dedicated to operations on boolean values. Instead, expressions in the Java programming language that operate on boolean values are compiled to use values of the Java virtual machine int data type.
The Java virtual machine does directly support boolean arrays. Its newarray instruction enables creation of boolean arrays. Arrays of type boolean are accessed and modified using the byte array instructions baload and bastore.2
The Java virtual machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java virtual machine type int, the compilers must use the same encoding.
This is consistent with the fact that byte, short and char are almost always promoted to int the moment they are used in any calculations. Java is set up to assume that a four-byte int is the smallest natural word length on any machine it's running on, so in many cases there's little point in trying to use a smaller value.
And check out this footnote:
In Sun's JDK releases 1.0 and 1.1, and the Java 2 SDK, Standard Edition, v1.2, boolean arrays in the Java programming language are encoded as Java virtual machine byte arrays, using 8 bits per boolean element.
And, from the API for writeBoolean() in DataOutputStream:

Writes a boolean to the underlying output stream as a 1-byte value. The value true is written out as the value (byte)1; the value false is written out as the value (byte)0.
(Quotes :Jim Yingst, May 15, 2000)
regards
bob_towers@hotmail.com
If you read the khalid Mughal & Rasmussen book they tell you the size of a boolean in bits is, and get this: "non applicable" (see page 33 - table 2.14). However, RHE say that the number of bits is 1 (for true and false). However, the smallest unit of memory storage is a byte, the CPU can address bytes not bits. So a boolean must be stored in a byte.
For the purposes of the exam, what is the correct answer: not applicable, 1 bit or 8 bits ?
If a friendly sherrif or bartender should happen to wander by this post please do shed some light on this somewhat unclear issue.
best wishes
bob towers
What's wrong with smoking? I mean apart from the cost, the smelly breathe, the smelly clothes, the stains on your teeth and fingers, the way it gives you lung cancer, and contributes to heart disease, the cancer of the mouth and throat, the bronchitis and chest infections, the way it makes you look pale and wan, the increased cost of health insurance, and the reduced life expectancy, the way you can't compete in sports, or even run for a bus... i mean apart from that, what's wrong with smoking ?
Answers on an email please to bob_towers@hotmail.com
cheers, anyone got a fag?
bob towers
19 years ago