fork download
  1. import java.util.*;
  2. import java.text.*;
  3. public class sample{
  4. public static void main(String[] args) {
  5. try { String str_date="11-June-07";
  6. DateFormat formatter ;
  7. Date date ;
  8. formatter = new SimpleDateFormat("dd-MMM-yy");
  9. date = (Date)formatter.parse(str_date);
  10. System.out.println("Today is " +date );
  11. } catch (ParseException e)
  12. {System.out.println("Exception :"+e); }
  13.  
  14. }
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: class sample is public, should be declared in a file named sample.java
public class sample{
       ^
1 error
stdout
Standard output is empty