9 Replies - 1515 Views - Last Post: 02 March 2010 - 07:59 PM Rate Topic: -----

#1 xor-logic   User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 767
  • Joined: 04-February 10

List of class attributes in the API?

Posted 02 March 2010 - 01:08 PM

Where can I find a list of attributes of a particular class in the Java API, such as length for arrays? I already checked out the java.util.array page - didn't find anything about length or any other attributes an array has.
Is This A Good Question/Topic? 0
  • +

Replies To: List of class attributes in the API?

#2 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12742
  • View blog
  • Posts: 45,926
  • Joined: 27-December 08

Re: List of class attributes in the API?

Posted 02 March 2010 - 01:15 PM

The only attribute an array has is length. If you have an IDE like NetBeans or Eclipse, it should tell you all the accessible attributes and methods of an object if you use the dot-notation, like so: objname., and a list should pop up.
Was This Post Helpful? 1
  • +
  • -

#3 xor-logic   User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 767
  • Joined: 04-February 10

Re: List of class attributes in the API?

Posted 02 March 2010 - 01:33 PM

So are these not listed anywhere in the API?
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12742
  • View blog
  • Posts: 45,926
  • Joined: 27-December 08

Re: List of class attributes in the API?

Posted 02 March 2010 - 01:38 PM

Not that I'm aware of beyond the IDEs. Arrays also extend the Object class, so they have the same methods as Object, but the only attribute they have is length.
Was This Post Helpful? 1
  • +
  • -

#5 cfoley   User is offline

  • Cabbage
  • member icon

Reputation: 2408
  • View blog
  • Posts: 5,044
  • Joined: 11-December 07

Re: List of class attributes in the API?

Posted 02 March 2010 - 03:36 PM

The API lists all the attributes that you can access. Mostly these are constants like in the Color class (stuff like Color.white, Color.black, etc) but sometimes they are mutable like in the Rectangle class. Just look under "Fields"!
Was This Post Helpful? 2
  • +
  • -

#6 Dogstopper   User is offline

  • The Ninjaducky
  • member icon

Reputation: 2972
  • View blog
  • Posts: 11,223
  • Joined: 15-July 08

Re: List of class attributes in the API?

Posted 02 March 2010 - 03:43 PM

cfoley, I think that xor-logic wanted the attributes for a normal array, not the API in general...but thanks!
Was This Post Helpful? 1
  • +
  • -

#7 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: List of class attributes in the API?

Posted 02 March 2010 - 05:50 PM

View Postxor-logic, on 02 March 2010 - 02:33 PM, said:

So are these not listed anywhere in the API?

array.length is not part of the API is part of the basic language definition
would be there even if there were no API
Was This Post Helpful? 1
  • +
  • -

#8 cfoley   User is offline

  • Cabbage
  • member icon

Reputation: 2408
  • View blog
  • Posts: 5,044
  • Joined: 11-December 07

Re: List of class attributes in the API?

Posted 02 March 2010 - 06:33 PM

Dogstopper:

Quote

Where can I find a list of attributes of a particular class in the Java API, such as length for arrays?


Maybe, maybe not. As PBL says, arrays aren't part of the API which makes the question ambiguous. In any case, I hope my reply was harmless at worst. :)
Was This Post Helpful? 0
  • +
  • -

#9 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12742
  • View blog
  • Posts: 45,926
  • Joined: 27-December 08

Re: List of class attributes in the API?

Posted 02 March 2010 - 06:57 PM

I just want to further clarify about the array type noted by the square brackets (ex: Object[], int[]) vs. the java.util.Arrays class. The array type noted by the brackets is the actual block of memory to store a group of elements. Its methods are inherited from java.lang.Object, and its only attribute is length. The java.util.Arrays class was designed to provide additional functionality to work with the arrays, but not to be instantiated, as noted by a lack of a constructor in the API and the fact that all of its methods are static, meaning they are designed to be called using the class name instead of an instance of the class (an object).
Was This Post Helpful? 2
  • +
  • -

#10 xor-logic   User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 767
  • Joined: 04-February 10

Re: List of class attributes in the API?

Posted 02 March 2010 - 07:59 PM

@mac, thanks. That last bit was the source of my issue, namely that I was wr... wro... wrooon... uh, mistaken. Thanks for clearing that up.

View Postcfoley, on 02 March 2010 - 05:33 PM, said:

Maybe, maybe not. As PBL says, arrays aren't part of the API which makes the question ambiguous. In any case, I hope my reply was harmless at worst. :)


Harmless? Absolutely not! It will take me years to overcome the misinformation with which you have marred my education :P! Nah, just kiddin. My question was actually two fold, part about arrays in particular, and part about where to find that type of info in general, so you helped. Thanks.

This post has been edited by xor-logic: 02 March 2010 - 08:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1