File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a question on Runtime.getRuntime().totalMemory()

 
cake naiyou
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following function is used to compute memory usage.



I do not understand how to understand "Runtime.getRuntime().totalMemory()"? In specific, how to understand the relationships connecting "Runtime", "getRuntime()" and "totalMemory()"?
 
Rob Spoor
Sheriff
Pie
Posts: 20399
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime is an abstract class. There is no direct way to instantiate it. It has a static method to get an instance of some unknown subclass. This method is called getRuntime(). Therefore, Runtime.getRuntime() returns an instance of a subclass of Runtime.
totalMemory() is an instance method that you call on that instance. Your single line is similar to this:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic