aspose file tools*
The moose likes Beginning Java and the fly likes Need help understanding exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help understanding exception" Watch "Need help understanding exception" New topic
Author

Need help understanding exception

Bill Parsh
Greenhorn

Joined: Nov 20, 2008
Posts: 9
Google didn't help much , so I'm trying you guys.

Error - java.lang.ClassCastException: [C cannot be cast to java.lang.Double

What does [C mean?

My application interfaces with a 3rd party application which causes the exception to be shown in a pop up window, so I don't get a full trace in Netbeans. This exception is also hard for my to duplicate, making it even harder for me to diagose.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19762
    
  20

If a class name starts with [ that means it is an array. As for C, that's one of the reserved names for the primitive types. See http://dev.kanngard.net/Permalinks/ID_20050509144235.html for a more extensive list.

In this case, [C means char[].


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

"[C" is "array of char." The notation is called a "field descriptor", and it's the closest thing an array class has to a class name. See the Java Virtual Machine Specification.

[ Edit: Darn, Rob beat me to the punch. ]


[Jess in Action][AskingGoodQuestions]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18996
    
  40

What does [C mean?


In Java type speak, "[" means array of, and "C" means a primative char type. So, "[C" means an array of chars... ie.... something like....

char [] cvar = new char[10];

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Bill Parsh
Greenhorn

Joined: Nov 20, 2008
Posts: 9
I'm also getting exception: access violation 0xc0000005 in this and other code that has never given me a problem before. Also, sometimes I'll just be typing in Netbeans and suddenly it will disappear and I'll be looking at my empty desktop, no error messages, no pop up. I've tried updating and reinstalling the JDK and Netbeans but that hasn't helped. I'm planning to reformat this weekend.

I'm having a real hard time understanding how my code could be causing the [C exception, is it possible that whatever is causing the access violation is somehow causing this too?
Bill Parsh
Greenhorn

Joined: Nov 20, 2008
Posts: 9
I ended up having a bad stick of RAM. I took it out and the [C exceptions and the access violations seem to be gone.
 
Don't get me started about those stupid light bulbs.
 
subject: Need help understanding exception