> From: Martin Gainty [mailto:[EMAIL PROTECTED] > Subject: Re: How do I ........? > > This is one of those SS!=DS discussions which means that > variables placed/alloc'ed on the stack are NOT the same as > variables alloc'ed from heap > so > when using a variable which is alloced on the stack AND > initialised to some known value (null) > feel free to test that pre-allocated stack variable as with > if(stack_variable == null) > > If you dont know how this variable is alloc'ed or you know > that the variable is alloc'ed from heap use try / > catch(NullPointerException npe) > > to do otherwise you're risking your webapp causing 'an > unhandled exception' when referencing a unalloc'ed variable..
A continuing display of your ignorance and irrelevance. Sounds like you're confusing the issue with variable and field initialization. Variables in Java are always thread-local and within the scope of a method; their allocation is up to the particular JVM implementation and need not be materialized in memory at all. They also do not have any pre-defined initial values in lieu of an explicit initialization expression. Fields are associated with an object instance or class (if static); most JVMs do allocate objects from a heap, but again there's no spec requirement to do so. Static fields are also usually allocated from a heap, but not necessarily the same one as instances. By definition, fields have an initial value of zero, null, or false (depending on type), if not specified by an initialization expression. None of this has any bearing on whether or not it's valid to use a var == null expression, which, of course, is always an acceptable thing to do. The fact that you can't seem to do it speaks only to your programming skills, not anything in the Java language. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]