Can we able to compile and execute Java Program without Class?

Can we compile and execute without class?
yes
    jdk 1.5 :  enum;
    jdk 1.8 :  interface;

Code:  Using Enum

enum Test
{
;
public static void main( String args[] )
{
System.out.println(" Coding Atharva ");
}
}




Output:

How to compile and execute Java Program without Class Using Enum

Code:  Using interface

interface Test
{
public static void main( String args[] )
{
System.out.println( " Coding Atharva  " );
}

}




Output:



Previous
Next Post »