• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.util.Arrays - why return static variables?

 
Chris Jones
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the methods in java.util.Arrays return static variables.

Why is it necessary to say return a static String from the toString(int[] a) method?

all clues are greatly appreciated!
[ February 18, 2008: Message edited by: Chris Jones ]
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not in the JVM I am using at the moment (Sun's). There aren't even any static variables in the class that I can see. Why do you say that?
 
Henry Wong
author
Marshal
Pie
Posts: 22091
88
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it necessary to say return a static String from the toString(int[] a) method?



The "static" in the definition is referring to the fact that the toString() method is static. It is not returning a "static String"...

Henry
 
Chris Jones
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, sorry. I misread the java API docs. The column that holds the return type also holds the static modifier.

It is obviously the method that is static and not the return value. I got confused. But thanks for taking the time/sorry for wasting it.

/Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic