package org.interview.test;
import java.net.InetAddress;
import java.util.Random;
public class SystemCommands {
public static void main (String [] args) throws Exception {
Runtime rt = Runtime.getRuntime();
//rt.exec("notepad");
//rt.exec("mspaint");
System.out.println("Free memory in JVM before Garbage Collection = "+rt.freeMemory());
rt.gc();
System.out.println("Free memory in JVM after Garbage Collection = "+rt.freeMemory());
System.out.println(InetAddress.getLocalHost());
int c;
Random t = new Random();
// random integers in [0, 100]
for (c = 1; c <= 10; c++) {
System.out.println(t.nextInt(100));
}
}
}
import java.net.InetAddress;
import java.util.Random;
public class SystemCommands {
public static void main (String [] args) throws Exception {
Runtime rt = Runtime.getRuntime();
//rt.exec("notepad");
//rt.exec("mspaint");
System.out.println("Free memory in JVM before Garbage Collection = "+rt.freeMemory());
rt.gc();
System.out.println("Free memory in JVM after Garbage Collection = "+rt.freeMemory());
System.out.println(InetAddress.getLocalHost());
int c;
Random t = new Random();
// random integers in [0, 100]
for (c = 1; c <= 10; c++) {
System.out.println(t.nextInt(100));
}
}
}
No comments:
Post a Comment