You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by senthil Kumar <se...@tarangtech.com> on 2005/07/20 11:43:51 UTC

Struts how initialises the value

Hi all.,


long productId;
long productId = 0;


Sting abc;
Sting abc = null


In struts, how the above satements are differ?.
is it compulsary to initialise the  value?. 
What are all the advantage to initialise the value?.



Regs.,
Senthil

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents.

Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved

Re: Struts how initialises the value

Posted by ichy <ic...@gmail.com>.
Hi, Senthil.
 if you don't set initial values for fields you declare, they are 
initialized as mentioned
in java specification. you can check at
 
http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5
 so, 
long productId;
long productId = 0;
are the same.
 String abc;
String abc = null;
are the same.
 these are not struts specifc.
 are you talking about anything struts-specific thing such as ActionForm?
 regards
ichy

Re: Struts how initialises the value

Posted by Vijay K Anand <vi...@freescale.com>.
It is no way different to struts

Primitive types are always initilxed to its defaults...

senthil Kumar wrote:

>Hi all.,
>
>
>long productId;
>long productId = 0;
>
>
>Sting abc;
>Sting abc = null
>
>
>In struts, how the above satements are differ?.
>is it compulsary to initialise the  value?. 
>What are all the advantage to initialise the value?.
>
>
>
>Regs.,
>Senthil
>
>This e-mail and any files transmitted with it are for the sole use of
>the intended recipient(s) and may contain confidential and privileged
>information. If you are not the intended recipient or received it in
>error, please contact the sender by reply e-mail and destroy all copies
>of the original message. Please do not copy it for any purpose or
>disclose its contents.
>
>Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights
>Reserved
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Struts how initialises the value

Posted by raghavendra <ra...@globalcase.net>.
Hi senthil Kumar
  See senthil Struts class exact to any other java class. All class
level variables are takes default values. So not only in struts all java
class in the following initializes are same.
long productId;
long productId = 0;
Sting abc;
Sting abc = null

-----Original Message-----
From: senthil Kumar [mailto:senthils@tarangtech.com] 
Sent: Wednesday, July 20, 2005 3:14 PM
To: user@struts.apache.org
Subject: Struts how initialises the value

Hi all.,


long productId;
long productId = 0;


Sting abc;
Sting abc = null


In struts, how the above satements are differ?.
is it compulsary to initialise the  value?. 
What are all the advantage to initialise the value?.



Regs.,
Senthil

This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient or received it in
error, please contact the sender by reply e-mail and destroy all copies
of the original message. Please do not copy it for any purpose or
disclose its contents.

Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights
Reserved



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org