Kali Praveen

Greenhorn
+ Follow
since May 27, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Kali Praveen

Please look at Corey's tipline on this topic.

Increment Decrement Operators

Hope this helps.
Netty,
In both the cases you have to use MyException instead of IOException. The reason being you always try to catch Exception that is being thrown. According to your code doStuff() throws MyException. So that should be the one you should be catching. Keep in mind that MyException extends Exception and not IOException( IOException being a subclass of Exception). So you cannot catch IOException in the places where MyException is caught. The compiler complains that IOException is never thrown in scope. You could otherwise say something like


or


This is valid because MyException is subclass of Exception and not IOException. Hope this clears your doubt.
Sorry. Didnt see Louie's post.
Netty,
The switch statement always looks for the matching case constants. If there is a matching case constant, then that would be the first statement that gets executed. After that the execution of switch statement falls through the labels. That is all the statements after the matching case are executed. If there is no matching case constant, then it looks for default label and all statements after default label are executed.

In first case since k=10 and there are no break statements after each case, it prints 10,20.

In second case , it prints 10,20,default since default case is after case 10.

Try the following and you would see that default is printed first.
I wanted to know if there is an UBB code for appending line numbers before each line of the code. It would be nice to have such feature in case there is no such feature already existing. It would be easier to refer to line number when the code is lengthy. If it is already existing please let me know.

Thanks,
Praveen
20 years ago
I was looking at the following example in JLS and couldn't think of why
there is no compilation error on lines 9,10,21,22 where as there is compilation error on line 18. I could get the reasons for other errors except for the errors/non-errors on those lines.


Thanks,
Praveen
Thanks Barry. I was a bit confused by the wording and was not thinking about internal classes at all. The example did clear all my doubts.
I was reading JLS for my SCJp preparation when I came across the following lines in chapter 8.


Note that a private field of a superclass might be accessible to a subclass (for example, if both classes are members of the same class). Nevertheless, a private field is never inherited by a subclass.



I know that private field is not accessible by sub classes. But I cant understand how a private field can be accesible by subclass. Can any give me a
simple example for that.

Thanks
I am trying to build a web application using Struts framework in JBuilder X. I am using Apache Tomcat. The application deploys fine when I do deployment thru manager application in Tomcat. But when I try to run the application thru JBuilder X IDE I get HTTP Status 500 - No Context configured to process this request. I am not sure if I am missing something here.
I agree with shivkumar. Canonical representations give us the same references. For your example

System.out.println(x1 == x2.intern());

it will print true because x2.intern() will return the value of x2 in the pool.