Igor Ko

Ranch Hand
+ Follow
since Jun 24, 2002
Merit badge: grant badges
For More
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 Igor Ko

embeded (java definition, jvm implementation)
19 years ago
Example


if we have shallow clone of instance a1 - a2 it will have values
{ sb1, 1 }, where sb1 the reference to the same instance of StringBuffer,
that has in a1.

So if you now change the StringBuffer in a1, it will be changed also
in a2.

If it is deep clone of a1 - a3, it will have other instance of StringBuffer
(with the same saved value "abcd"). So now if you change StringBuffer in
a1, a2 still have the same value "abcd".

By default java make shallow clone.
19 years ago
It is not do while problem...

In such case to check some logical process, see it in debuger,
or add printing (likes System.out.println("go to left..."))
for each logical brach, and then you easy can see how it is working...
19 years ago
or Java++

(really because I begin from PL/1 (=COBOL+ALGOL+FORTRAN)
I don't like complex languages)
[ June 30, 2004: Message edited by: Igor Ko ]
19 years ago
It is not very simple, see library from:

http://www.javaworld.com/javaworld/javaqa/2003-12/02-qa-1226-sizeof.html

Them use introspection, and build tree for all including objects, until
go to primitive type.
19 years ago
I think auto boxing/unboxing don't worth for such language complication.

Now you should spend more time to understand simple program, and for what ?
19 years ago
Good title.

It is simple, see explanation why Microsoft invent now .net and c#
Because normal programmer can't write server that works 24 hours, 7 days in
week without reboot in C, C++. There will be a lot of bugs in a typical program with multi-threading and dynamic data structure. And you must
be professional and spend a lot of time to catch them.

Language with garbage collection (likes Java, C#) much
more stable, and easy to use in such cases.

So you can think less about memory leaks,
or wrong pointers, stack overflow, strings library, thread synchronization,
bugs and features of your OS...

But more about what your program must do.

Price for it is CPU/memory usage, but now computers double
its power each 1.5 years (about).

---------------------------------------------------------------
Yes, C++ is more complex language than java.
But it will be fixed in new java release

see version 1.5
(generics,function with variable number of arguments, auto boxing/unboxing,
language built-in class enum, and other complicate features)
[ June 16, 2004: Message edited by: Igor Ko ]
19 years ago
Is it your homework ?

Trying in google "Lazy initialization", and found:

http://www.javapractices.com/Topic34.cjp

So it's simply idea - don't create object, until someone will get it...
And your code:


But I'm sure that it is homework -
some very simple idea, and big name for it.
Why don't you use Google to search ?
[ June 16, 2004: Message edited by: Igor Ko ]
19 years ago
If you know very good about EACH BYTE in your record, you can
open file as byte stream, and read the data and convert it
to corresponding integer, double, string.
(for example integer in your record can be 2 or 4 bytes, probably
you should swap bytes (use bits operations) String represent as
fixed size bytes sequence, or character counter (2 bytes) and then
bytes, or it is bytes zero terminated sequence... etc.
But it isn't so simple.
So if you can wrote the record, not as binary representation of
(int, double, strings) but as text representation, of course you
can easily read it in java.
19 years ago
try it, it will help:


If the promoted type of the left-hand operand is int, only the five lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & (�15.22.1) with the mask value 0x1f. The shift distance actually used is therefore always in the range 0 to 31, inclusive.

Java Language Specification.
So actually:
shfit -1 is shift to 31
shift -2 is shift to 30
shift -3 is shift to 29
shift -4 is shift to 28
. . . . . . . . . . . . .
[ March 15, 2004: Message edited by: Igor Ko ]
20 years ago
At compilation:
1. programm divide to lexical units,
2. and then from the units, build (and check) grammar structure.
3. .....
So I think "parse error" - error during phase 1,
" syntax error" - error during phase 2.
[ March 15, 2004: Message edited by: Igor Ko ]
20 years ago
short is 2 bytes, not 4.
static and not static can be distinguish by word "static"
Member variables are member of class likes:
class xxx {
int x;
float y;
String z;
}
x,y,z - memeber of class xxx.
Local variable likes:
boolean func(){
int x1;
String z1;
}
x1, z1 - local, will be created in the stack when function "func"
will be called.
[ March 15, 2004: Message edited by: Igor Ko ]
20 years ago
Yes... but if it's wireless mouse ???
20 years ago
You should see description of jar utility: if you wish create
EXECUTABLE jar, you have build some special 'manifest' of
the jar...
(because jar can contains a lot of classes with main function, what
main should use JVM ? According jar manifest)
20 years ago