class test
{

public static void main(String[] args)
{
Date d = new Date(2011343412345L);
DateFormat df = new DateFormat();
System.out.println(df.format(d));
}

}

What would be the result?

Options
- 26 Sep, 2033
- 2011343412345L
- An exception is thrown at runtime.
- A compile time error.


CORRECT ANSWER : A compile time error.

Discussion Board
Date Format

DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting (i.e., date -> text), parsing (text -> date), and normalization. The date is represented as a Date object or as the milliseconds since January 1, 1970, 00:00:00 GMT.

Manish Malaviya 11-20-2014 05:41 AM

solution

it gives a error


Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Cannot instantiate the type DateFormat



Piush 07-2-2014 01:32 PM

Write your comments

 
   
 
 

Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement