File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "array problem" Watch "array problem" New topic
Author

array problem

HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
give:
byte[] a1=new byte[]{1,2};
byte[] a2=new byte[]{3,4};
a1=a2;
it cann't compile! Why?
In fact any reference varible cann't
be assigned by another same type reference on my
computer!
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
It compiles fine on my machine :roll:
That code is perfectly legal.
What is the compilation error?
[ August 21, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
thanks a lot!
something wrong with my computer!
But maybe is there something wrong with my
circumstance? I just have tried -source 1.4
and assert...
HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
the compile error message is:
*******************************
Test147.java:34: <identifier> expected
a1=a2;
^
Test147.java:34: cannot resolve symbol
symbol : class a1
location: class Test147
a1=a2;
^
2 errors
**********************************
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Please, could you also post the relevant part of your code that is causing that problem. Thanks...
HiBob Chu
Ranch Hand

Joined: Aug 12, 2002
Posts: 86
oops! I get it!
I placed the statements out of the main funtion!
thanks again!
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
There you go
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: array problem