Can we compile and execute without class?
yes
jdk 1.5 : enum;
jdk 1.8 : interface;
Code: Using Enum
Code: Using interface
Output:
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 ");
}
}
{
;
public static void main( String args[] )
{
System.out.println(" Coding Atharva ");
}
}
Output:
interface Test
{
public static void main( String args[] )
{
System.out.println( " Coding Atharva " );
}
}
{
public static void main( String args[] )
{
System.out.println( " Coding Atharva " );
}
}
Output: