File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Need help understanding exception

Bill Parsh

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

Joined: Oct 27, 2005
Posts: 20269

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 for a more extensive list.

In this case, [C means char[].

How To Ask Questions How To Answer Questions
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

"[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

Joined: Sep 28, 2004
Posts: 20514

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];


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

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

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.
I agree. Here's the link:
subject: Need help understanding exception
It's not a secret anymore!