Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

Re: thanks rafa

Brian P Bohnet

2004-03-10


Your code is incorrect, you cannot manipulate an array that way, see
error produced:

: operator + cannot be applied to char[],int
     foo = foo + 1;
            ^

Rafael Tolosana wrote:

> I will try it with two simple examples:
>
> First have a look at this Java code:
> String foo = new String("Example String");
> String foo2 = foo;
>
> Now have a look at this C code:
> char[] foo = "Example String";
> char[] foo2 = foo;
> foo = foo + 1;
>
> In the first example we have two references to the same object String,
> but you cannot manipulate the memory address of the references. On the
> other hand, in the second example we have two pointers to the same
> memory zone and the foo variable has been incremented by one, so that
> it will point to "xample String".
>
> I hope this will help you understand
>
> Rafa

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com


©2008 junlu.com - Jax Systems, LLC, U.S.A.