473,769 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sizeof class

sanjay123456
125 New Member
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 2381
dmjpro
2,476 Top Contributor
why r u looking for this....
there is shortcut way for this..
plz check out this link..........

http://www.javapractic es.com/Topic83.cjp
Feb 8 '07 #2
sanjay123456
125 New Member
Dear Dmjpro ,

u r URL is not valid ?

sanjay
Feb 8 '07 #3
dmjpro
2,476 Top Contributor
try it type in address bar...
it will work
Feb 8 '07 #4
r035198x
13,262 MVP
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
JavaStudent07
64 New Member
just put,
^^^^^

System.out.prin tln("Hello");

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

^^^^^



System.out.prin tln(\"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
JavaStudent07
64 New Member
:) so lol, thats the next question :)
Feb 8 '07 #8
horace1
1,510 Recognized Expert Top Contributor
:) 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.churchillob jects.com/c/13029.html

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

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

Similar topics

3
3556
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 know it returns two bytes in UniCode. Please help... For ANSI: In ISO/ANSI C++ Standard, 5.3.3 § 1, it stays: "The sizeof operator yields the number of bytes in the object representation of its
4
3107
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 derived from it. At a particular point in my application I need the size of the object pointed to by the base pointer. Eg
2
2469
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
2746
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
421
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 Imports System.Runtime.InteropServices Public Class DriveInfo
6
10819
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 lines)? TIA! sb
9
8445
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
2591
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 the size occupied by that datatype in memory in bytes. Thanks :) Abhishek Srivastava
2
2590
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 oFileDialog( ... ); There are some problems in the debug, look the sizeof from the debug :
7
1972
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. The original post at gnu.gcc.help can be found at this link http://groups.google.com/group/gnu.gcc.help/browse_thread/thread/ece55cbbd9c36270/2148a6c1ac6119e1?lnk=st&q=#2148a6c1ac6119e1 Here's the question: class base {
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.