OSA B8



 B8: Java Program to Identify the available memory in the system..


Program:

import java.io.*; 
public class MemoryExp 
{
public static void main(String[] args) 
{
try
{
System.out.println("Total Memory"+Runtime.getRuntime().totalMemory());    
System.out.println("Free Memory"+Runtime.getRuntime().freeMemory());
}
catch(Exception e) 
{
System.out.println("Exception found " +e);
}
}
}

Output:

[student@localhost ~]$ javac MemoryExp.java
[student@localhost ~]$ java MemoryExp
Total Memory31195136
Free Memory30703360

0 comments:

Post a Comment