473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

sizeof class

sanjay123456
125 100+
dear Friends

see the following code

Expand|Select|Wrap|Line Numbers
  1.  
  2. public class hello
  3. {
  4.   public static void main(args[])
  5.   {
  6.  
  7.   }
  8. }
  9.  
  10.  

how i find the size of this class hello ?
because sizeof operator is not work in java ?


sanjay
Feb 8 '07 #1
8 2365
dmjpro
2,476 2GB
why r u looking for this....
there is shortcut way for this..
plz check out this link..........

http://www.javapractices.com/Topic83.cjp
Feb 8 '07 #2
sanjay123456
125 100+
Dear Dmjpro ,

u r URL is not valid ?

sanjay
Feb 8 '07 #3
dmjpro
2,476 2GB
try it type in address bar...
it will work
Feb 8 '07 #4
r035198x
13,262 8TB
dear Friends



see the following code



Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4. public class hello
  5.  
  6. {
  7.  
  8. public static void main(args[])
  9.  
  10. {
  11.  
  12.  
  13.  
  14. }
  15.  
  16. }
  17.  
  18.  
  19.  
  20.  




how i find the size of this class hello ?

because sizeof operator is not work in java ?





sanjay


What do you mean by size of the class? Do you mean size of an object created that class?
Feb 8 '07 #5
just put,
^^^^^

System.out.println("Hello");

^^^^^^
that should give you a print out of "Hello" on the command prompt.
Feb 8 '07 #6
r035198x
13,262 8TB
just put,

^^^^^



System.out.println(\"Hello\");



^^^^^^

that should give you a print out of \"Hello\" on the command prompt.


OP did not say he/she wanted to print hello to the screen!
Feb 8 '07 #7
:) so lol, thats the next question :)
Feb 8 '07 #8
horace1
1,510 Expert 1GB
:) so lol, thats the next question :)
sometime back I needed to find the approximate size of an object (cannot remember why now!) and used this
http://www.churchillobjects.com/c/13029.html

also take a look at
http://www.javaworld.com/javaworld/javaqa/2003-12/02-qa-1226-sizeof.html
http://martin.nobilitas.com/java/sizeof.html
Feb 8 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Sunil Menon | last post by:
Dear All, A class having no member variables and only a method sizeof(object) will return 1byte in ANSI and two bytes in Unicode. I have the answer for this of how in works in ANSI. But I don't...
4
by: Gopal-M | last post by:
I have the problem with sizeof operator I also want to implement a function that can return size of an object. My problem is as follows.. I have a Base class, say Base and there are many class...
2
by: Xiangliang Meng | last post by:
Hi, all. What will we get from sizeof(a class without data members and virtual functions)? For example: class abnormity { public: string name() { return "abnormity"; }
12
by: Casper | last post by:
How would one go about summing up the memmory custom tree structures occupies in memmory? Example: struct node { struct node *parent; unsigned int nChildCount; string folder; //string class...
0
by: besaar | last post by:
i got the current project that got the serial no.of a hard disk for software protection but i got an error,if u solve it send me,thanx alllllll. 1.file1 Option Strict On Option Explicit On...
6
by: SB | last post by:
I feel dumb to ask because I bet this is a simple question... Looking at the code below, can someone please explain why I get two different values in my Marshal.SizeOf calls (see the commented...
9
by: Sameer | last post by:
Hi, I have a class. class C1 { int i ; char c ; } ; let me say the size of int is 4 and char is 1. Then if I say sizeof(C1) it should be 5, why is it showing 8 ?
32
by: Abhishek Srivastava | last post by:
Hi, Somebody recently asked me to implement the sizeof operator, i.e. to write a function that accepts a parameter of any type, and without using the sizeof operator, should be able to return...
2
by: GRenard | last post by:
Hello, We just switch in our company to VisualStudio 2005 and the new ATL library. We use a wrapper to use CFileDialog. Its name is CFileDialogDeluxe Here the call CFileDialogDeluxe...
7
by: Yen Kwoon | last post by:
Note: This problem is related to gcc but after some back and forth in group gnu.gcc.help it seems to have morph into more of a c++ specificiation question, hence the transplanting to this group. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.