This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Int cannot be dereferenced Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Int cannot be dereferenced" Watch "Int cannot be dereferenced" New topic
Author

Int cannot be dereferenced

Mark Kaichou
Greenhorn

Joined: Feb 13, 2012
Posts: 2
I've been spending hours and hours trying to figure what have I done wrong to no avail, I've spent a load of time online trying to figure it out but I still can't!!!
Error's at line 154 :/

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11447
    
  16

topTiming is declared as an int - a primitive type. Therefore, it doesn't have a length.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6



What would you expect that to mean? Primitives (byte, char, short, int, long, float, double, boolean) are not objects and do not have member variables or methods. They're just simple values. So you cannot do somePrimitive.something.
Mark Kaichou
Greenhorn

Joined: Feb 13, 2012
Posts: 2
Ahhhhh, I see, silly me, thanks for the prompt reply guys!
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

toptiming isn't an array ... you can't have length for primitive datatypes ...


http://plainoldjavaobject.blogspot.in
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Int cannot be dereferenced