mohitkumar gupta wrote:
the above code complied fine.
are there anymore coding tricks that may come in the scjp exam
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
mohitkumar gupta wrote:
the above code complied fine.
are there anymore coding tricks that may come in the scjp exam
SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar wrote:
mohitkumar gupta wrote:
the above code complied fine.
are there anymore coding tricks that may come in the scjp exam
but if you try to do this
System.out.println(x);
then it will throw runtime exception
0
Shanky Sohar wrote:
mohitkumar gupta wrote:
the above code complied fine.
are there anymore coding tricks that may come in the scjp exam
but if you try to do this
System.out.println(x);
then it will throw runtime exception
No it does not:
Result:
0
(Built in Eclipse, ran with Java 1.6.0_20).
SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar wrote:
this is correct for instance or class and static variable.but not for local varaiables
for example..this will not work
also by mistake i say runtime error above but it will be compile time error
Sven Mathijssen wrote:
You are completely right, but the compile time error is not due to the extra semicolon at the end. If you omit the semicolon, it will still not compile.
SCJP6.0,My blog Ranchers from Delhi
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Prasad Kharkar wrote:the compiler in that case will be because the int x variable will be locla variable and that should be initialized before using it
SCJP6.0,My blog Ranchers from Delhi
Cheers,
Divyesh.
Pedro Kowalski wrote:One thing I bumped into recently is that
compiles and runs fine but shows warnings about 'dead code', while this
doesn't even compile because of unreachable code.
Cheers,
Divyesh.
SCJP6.0,My blog Ranchers from Delhi
Don't get me started about those stupid light bulbs. |