Home Java Java-get-example Java Get Memory



Java Get Memory
Posted on: May 27, 2009 at 12:00 AM
In this section of Java Example, you will see how to get the memory size using Java programming language.

Java Get Memory

     

In this section of Java Example, you will see how to get the memory size using Java programming language. This is a very simple example and you can easily learn it.

In this Java Get Memory Size example, we have created a class called Memory and defined all the functionality in it to show the memory size. System.out.println is used to print the result on the command prompt.

Code to Get Memory Size in Java

public class Memory {

    public static void main(String[] args) {
 
       System.out.println("Total Memory"+Runtime.getRuntime().totalMemory());    
       System.out.println("Free Memory"+Runtime.getRuntime().freeMemory());
}
}

Output will be displayed as:

Download Source Code

Related Tags for Java Get Memory:
cthissimpleexamplelearnexameareilitcanimasmcaxaxampsismpleaandarsimssthpleplndo


More Tutorials from this section

Ask Questions?    Discuss: Java Get Memory   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.