Log In Register

Units


Java Text Formatting - Questions and Answers

 

Practice these Java Text Formatting under Java Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Java Text Formatting for following purpose.


– Anyone who is wishing to increase their perfect knowledge of Java Text Formatting of Java Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge Java Programming specifically Java Text Formatting.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Java Text Formatting under Java Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Java Text Formatting topic of Java Programming:

 

1.  Which of this class can be used to format dates and times?

Answer: Option C

Explanation:
DateFormat is an abstract class that provides the ability to format and parse dates and times.

2. Which of these method returns an instance of DateFormat that can format time information?

Answer: Option B

Explanation:
getTimeInstance() method returns an instance of DateFormat that can format time information.

3.  Which of these package is used for text formatting in Java programming language?

Answer: Option A

Explanation:
java.text allows formatting, searching and manipulating text.

4. Which of these class allows us to define our own formatting pattern for dates and time?

Answer: Option B

Explanation:
The DateFormat is a concrete subclass of DateFormat. It allows you to define your own formatting patterns that are used to display date and time information.

5. Which of these formatting strings of SimpleDateFormat class is used to print week of the year?

Answer: Option A

Explanation:
By using format string “w” we can print week in a year whereas by using ‘W’ we can print week of month.

6. Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?

Answer: Option A

Explanation:
By using format string “a” we can print AM/PM in time.