javachamp
OCPJP 6.0 93%
OCPJWCD 5.0 98%
mohitkumar gupta wrote:
1.error:
unreported exception java.io.IOException; must be caught or declared to be thrown
file.createNewFile(); // line 5
why am i getting this error ?
i think file format is correct ,then why this error.
mohitkumar gupta wrote:
2.if i uncomment the lines 18,19,11 and put the code throws IOException,then output is
java.lang.IllegalArgumentException
mohitkumar gupta wrote:
3.if i uncomment the lines 18,19 and put the code throws IOException,then output is
java.text.ParseException: Unparseable date: "12.11.2009"
can anyone explain why these different outputs are coming ?
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
mohitkumar gupta wrote:
2.if i uncomment the lines 18,19,11 and put the code throws IOException,then output is
java.lang.IllegalArgumentException
If you explicitely throw that(IllegalArgumentException), then that will be thrown. What surprise here?
OCPJP 6.0 93%
OCPJWCD 5.0 98%
mohitkumar gupta wrote:i think output should be java.io.IOException since this IOException is automatically thrown when the line 10 is executed.
mohitkumar gupta wrote:i know that java.lang.IllegalArgumentException is thrown following the above line,then what happens to the IOException .
Is IllegalArgumentException overwriting IOException .
Joanne
mohitkumar gupta wrote:
1.error:
unreported exception java.io.IOException; must be caught or declared to be thrown
file.createNewFile(); // line 5
why am i getting this error ?
i think file format is correct ,then why this error.
2.if i uncomment the lines 18,19,11 and put the code throws IOException,then output is
java.lang.IllegalArgumentException
3.if i uncomment the lines 18,19 and put the code throws IOException,then output is
java.text.ParseException: Unparseable date: "12.11.2009"
can anyone explain why these different outputs are coming ?
OCPJP 6
OK, If I asked, for creating an Integer object, what would be the output, if you code like below?
Will it work?
SCJP6.0,My blog Ranchers from Delhi
SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar wrote:
OK, If I asked, for creating an Integer object, what would be the output, if you code like below?
Will it work?
Yes it will work.
but this will say compile time error
OCPJP 6
Vinoth Kumar Kannan wrote:
Shanky, Abhimaran might have asked this to Mohitkumar, just to make him understand the compiler cannot just understand whatever we give it. Like... it will never know "one" is 1! Thats the point.
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Abimaran Kugathasan wrote:
Vinoth Kumar Kannan wrote:
Shanky, Abhimaran might have asked this to Mohitkumar, just to make him understand the compiler cannot just understand whatever we give it. Like... it will never know "one" is 1! Thats the point.
Good catch! Thanks Vinoth Kumar Kannan!
SCJP6.0,My blog Ranchers from Delhi
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |