Core Java Technology Section Index | Page 3
What is the use of start() function in starting a thread? Why we do not use the run() funtion directly to run the thread?
The start() method tells the Java Virtual Machine that it needs to create a system specific thread. After creating the system resource, it passes the Runnable object to it to execute its run() met...more
What debugging tools exist for Java?
Check out logging packages like
log4j and unit testing frameworks like
JUnit.
Check out static analysis tools such as
Metamata's
Audit
and
Metrics
products.
For dyanmic analysis and manipulati...more
In a switch statement, does it matter if I put the default condition at the top or bottom (or anywhere in between)?
You can put the default: labeled clause anywhere you
can put any of the switch's cases. In fact, you don't have to
specify a default case at all.
What are the differences between Java 1.0, 1.1, 1.2, and 1.3?
For changes between Java v1.0 and v1.1 check out: JDK 1.1.x Compatibility with Previous JDK Releases and JDK v1.1 New Features Summary.
For changes between Java v1.1 and v1.2 check out the JDK v1...more
What character escape sequences are available in Java?
Java provides escape sequences for several non-graphical characters. All characters can be specified as a hexidecimal Unicode character (uxxxx) with some as an octal character (ddd where the first...more
What does the "final" modifier mean on a method parameter and when should I use it?
The capability of using the final modifier on formal
parameters was introduced in the Java 1.1 update. Basically,
it's just like using final on a class field. That is to say
that using it tells ...more
How can I do variable-length argument lists?
Well, there's no direct support for variable-length method argument lists in Java. However, you can simulate this yourself using whatever object container you prefer such as the ubiquitous java.u...more
What is the strictfp modifier for? When would I consider using it?
The strictfp keyword may be applied
to both classes and methods. For classes (and interfaces), it specifies that all of the
expressions in all of the methods of the class
are FP-strict. For met...more
What is an overloaded method?
Overloaded methods are multiple methods in the same class that share the same name but have different parameter lists. Overloaded methods cannot have the same parameter lists with different return...more
What are the differences between instance and class variables?
Instance variables have separate values for each instance of a class. Class variables maintain a single shared value for all instances of the class, even if no instance object of that class exists...more
How can I store and manipulate unsigned bytes in Java?
The wacky thing about Java is that bytes, shorts, ints, and longs are all signed. Thus, the code:
byte b = 0xAA;
will generate an error (rather than a warning):
possible loss of precision
fo...more
How do I extend permissions to an applet without editing the policy file manually?
A: Short answer: Forget about Java 2 security (i.e. the policy file) when creating applets. No major web browser currently supports that security model. Instead, place the applet in ...more
How do I access environment variables?
Basically, you can't. Plus, not all platforms have environments to get variables from. Instead of using the environment to get something, consider using either resource files or System properties....more
Where do I get source code for an Internet search engine?
See How do I add a search engine to my web site? (though this covers searching your site, not the whole Internet).
Running a Web Crawler is a pretty big job. Do you have a couple of terabytes of...more
Is there any way to have a static initializer in a parent class executed when I instantiate a sub-class?
The static initializer is executed only when the arent class gets loaded.
class Parent {
static { //static initializer
System.out.println("executed");
}
}
class Child1 ex...more