Which is the Best Java Web Framework ?

Java - Things to know before your OCJP Exam - Utility Classes

1. * DateFormat is an abstract class. It provides a getDateInstance() static method to get Date Instance.

2. Following are valid Locale constructor

Locale ( String language )
Locale ( String language, String country )
Locale ( String language , String country, String variant )

3. While doing formatting using %f for float, it rounds the float to the closest value if less decimals are required. For ex - 3.97 becomes 3.4 if we do %.1f

4. * NumberFormat.setMaximumFractionDigits() method sets the max no of digits allowed in fraction portion of number.

5. Calendar is an abstract class and hence concrete subclass object should be instantiated using Calendar.getInstance(). Usually it returns the object of GeorgianCalendar.

6. Following DateFormat initialization are correct.

DateFormat df = DateFormat.getInstance();

DateFormat df = DateFormat.getDateInstance();
DateFormat df = DateFormat.getDateInstance(DateFormat.FULL);

8. Out of the following code , only 3rd is correct

Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).parse(str); 

Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).format(str); 

Date date = DateFormat.getDateInstance(DateFormat.LONG, Locale.US).parse(str);

9. split() and macthes() methods are there in Pattern as well as String class.

Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus


Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.