Core Java Technology Section Index | Page 4
What are the differences between typecasting and data conversion?
TypeCasting is a feature of the language whereby you are telling the compiler (and readers of your source code :-) that you explicitly want it to treat the object as if it were really of the type ...more
When returning from a wait(long), can I tell whether my object was signaled or the wait timed out?
There is a pretty standard way to check for this type of thing. You'll have to re-check your condition after the call to wait(timeout) returns:
public synchronized boolean acquire(long waitfor){
...more
Which types of exceptions can not be captured by a Java program?
All Exceptions and Errors can be captured by the user using
catch (Throwable t)
The question might be better put 'Which types of exceptions should NOT be captured by the user?'. You...more
Why/when should I use BigDecimal instead of double
for numerical calculations?
Precision and accuracy. double uses a fixed-size data format so it can't always be precise or accurate in its representation of numbers. On the other hand, the BigDecimal class will use as much ...more
How can I synchronize across two different classes?
The solution is to use a different monitor.
When you make a method synchronized, you are specifying that the currently running thread should obtain a monitor (lock) on the object which has the me...more
I am looking for a monitoring tool that will give me the status of the threads inside Weblogic?
I am looking for a monitoring tool that will give me the status of the threads inside Weblogic?
We are running Weblogic Server 5.1.0 service pack 8 on HPUX 11 servers in our production environment....more
If an object is referenced by a local variable -- is it safe from concurrency issues?
No. The local variable only holds a pointer to an object; if other threads can also point to this object, then it needs to be made thread-safe.
See also How do I ensure that my servlet is thread-...more
Is there some way to implement multi-tasking in Java (like "fork()" on UNIX)?
There isn't anything very portable, but (if you're willing to provide an implementation for each of your target platforms) you can either:
Have the host OS execute a new JVM (typically by calling...more
How is Rijndael, the new, proposed American Encryption Standard, pronounced?
I'm in the group that pronounces it "Rhine-dahl". Some folks pronounce it "reign-dahl". Native Dutch speakers pronounce it correctly. :-)
Which file, in which directory, contains a list of installed Java security providers for Sun's JREs?
They are in the file
$JAVA_HOME/jre/lib/security/java.security. Looks like:
#######################
security.provider.1=sun.security.provider.Sun
security.provider.2=com.sun.crypto.provider.SunJC...more
What is the maximum string length in Java?
Strings are represented as character array. Therefore, theoretical limit of String length is java.lang.Integer.MAX_VALUE. However, in most machines you will run out of memory before you could crea...more
How can I create a method which takes one or more optional parameters?
In my knowledge, there is no special construct in Java language that allows for passing optional parameters. However, there are some workarounds that are worth considering:
Use of Collections: ...more
I'm creating a ZIP file using java.util.zip.ZipOutputStream. If the file names of these files are in any other language other than English (e.g. Chinese) they get distorted. when I extract the ZIP file using WinZip. How do I preserve the file names?
WinZip, and the ZIP file format in particular, only supports
ASCII characters for file names. The Java class ZipOutputStream
can't give you a capabillity which is not supported by the
underlying ...more
How can I create and use tree-like data structures in Java? Are there any standard classes for this?
No, there's no structures to represent a Tree. You can use collections.
A collection can contain more objects (leafs), and each leaf can be again a collection (node) and contain more leafs and so ...more
How can I create a protected, "restricted" website? I.e., where someone can only access the site by e.g., entering a password.
Normally web servers have their own protection system already in place. If you are running Apache, for example, or anothe NCSA compliant web server, you can rely on the standard basic authenticati...more