Home arrow static arrow Java Programming [Archive] - how many classes?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - how many classes?
This topic has 3 replies on 1 page.

Posts:12
Registered: 7/22/04
how many classes?  
Aug 7, 2004 2:20 AM



 
I'm trying to learning java and I've read thatapplication startup time and memory footprint are typically directly proportional to the nmumber of classes I load. Now, my question is: inner classes should be counted or not?The implementation of an inner class has the same performance-weight of writing a different class (private or public)?
 

Posts:18,384
Registered: 21.03.00
Re: how many classes?  
Aug 7, 2004 2:29 AM (reply 1 of 3)



 
Hi,

Yes you should count them. If you look at the output from compilation of a class with innerclasses, you will se that they compiler to $number.class. E.g Test$1.class means that it is the first inner class of the outer class Test.

/Kaj
 

Posts:5,965
Registered: 5/17/03
Re: how many classes?  
Aug 7, 2004 1:29 PM (reply 2 of 3)



 
Basically a class is just a type definition. What takes space is when you instantiate them using new. It really doesn't matter how, where or when a class is defined. It's when they become objects they start using up memory.
 

Posts:12
Registered: 7/22/04
Re: how many classes?  
Aug 8, 2004 1:12 PM (reply 3 of 3)



 
Ok, I've understood! Thanks to all!
 
This topic has 3 replies on 1 page.