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
(1)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.