Java Code:
import java.io.IOException;
import java.io.RandomAccessFile;

public class SampleInterface {

  public static void main(String[] args) {
    try {
      RandomAccessFile r = new RandomAccessFile("myfile", "r");
      printInterfaceNames(r);
    } catch (IOException e) {
      System.out.println(e);
    }
  }

  static void printInterfaceNames(Object o) {
    Class c = o.getClass();
    Class[] theInterfaces = c.getInterfaces();
    for (int i = 0; i < theInterfaces.length; i++) {
      String interfaceName = theInterfaces[i].getName();
      System.out.println(interfaceName);
    }
  }
}