Share on Google+Share on Google+

SCJP Module-12 Question-7

Advertisement
The Sample program given below will test your understanding about how to formate the Date in Java.

Given below the sample code :

1. public static void format(String str) {
2. try {
3. float flt = Float.parseFloat(str);
4. } catch (NumberFormatException nfe) {
5. flt = 0;
6. } finally {
7. System.out.println(flt);
8. }
9. }
10.public static void main(String[] args) {
11.format("illlegal");
12.}

What will be the output of the above code ?

1. Compile error

2. 0.0

3. No output

4. 0

Answer

(1)

Advertisements

Posted on: July 22, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.