Determine what is represent by a class object, whether an interface or a class ???

This tutorial will use CreateInterface.java to determine whether class object from it, is an interface or a class. You can get it at Java Interface ( Part 1). Before you compile and execute source code below, you must make sure CreateInterface.class is locate same location with this java file.

***********************************************************
COMPLETE SOURCE CODE FOR : DetermineClassObjectIsClassOrInterface.java
***********************************************************


public class DetermineClassObjectIsClassOrInterface
{
public static void main(String[]args)
{
try
{
Class temp=Class.forName("CreateInterface");
if(temp.isInterface())
{
System.out.println("THIS CLASS OBJECT IS REPRESENT AN INTERFACE");
}
else
{
System.out.println("THIS CLASS OBJECT IS REPRESENT AN CLASS");
}
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


***********************************************************
JUST COMPILE AND EXECUTE IT
***********************************************************

RELAXING NATURE VIDEO