• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array problem

 
HiBob Chu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
HiBob Chu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, could you also post the relevant part of your code that is causing that problem. Thanks...
 
HiBob Chu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops! I get it!
I placed the statements out of the main funtion!
thanks again!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There you go
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic