Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Size of a Class.

 
Vijay Sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

class a
{
// some statements.

}


There is a class "a" with some statements. If i want to find the size of the class, is there any function in Java?

Please help me out with this.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you mean by "size of the class"? Why do you need to know it?
 
faisal usmani
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijay ,


No there is no way you can find the size of the object of any class(if u are refering that).It's not specified by the Java VM specification or the Java Language specification.


cheers
[ April 20, 2006: Message edited by: faisal usmani ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, there are several possible ways to interpret this, and before we try to discuss them all, I think it would be better to get an answer to Ilja's question. Size in bytes of the class in memory? Size in bytes of the class file? Size in bytes of the source file? Number of lines of code in the source file? Some other metric? The question is far too vague right now.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i know that you could debug, and maybe there is a way to count as

the debugger goes from line to line, if you mean length of code in the

class.

-Justin-
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic