aspose file tools
The moose likes Beginning Java and the fly likes data types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "data types" Watch "data types" New topic

data types

David raja

Joined: Jul 20, 2006
Posts: 1
How can i make print the size of a data type in java? like the sizeof function in C?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
You can't, except by hacky and unreliable methods. However, there are VERY few valid reasons for needing it. Why do you want it?

Search the forums for "sizeof" for more discussion.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11814

to quote Bert and Kathy, "Java is NOT C".

there are many things you can do in C that you can't do in java. and mostly, that's a good thing. Many of the things Sun got rid of are the things that caused all KINDS of headaches.

If you have a problem you're trying to solve, post that and we can help you find a good way to do it.

if you are just curious, well, sometimes there are little mysteries in live that we won't ever solve.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
It is sorta covered in the JavaRanch Style Guide.
subject: data types
It's not a secret anymore!