Rahul P Kumar

Ranch Hand
+ Follow
since Sep 26, 2009
India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rahul P Kumar

an if statement means one comparison. So, your whole attention should be how to minimize this comparison or ifs which are more likely to be encountered, should be first to encounter. Can condition be predecided and ifs are replaced by switch statement?
Foremost thing to be kept in mind is, if you have some business logic which demands to check some condition, you can not do something clever to not to check condition, only thing you can do is, how to make checking condition more efficient.
12 years ago
I've two packages A and B. Both have few common subpackages. I want to group them separately. how do I do that?
I've written:


ewm in group A and B have few common packages and likewise statera. Above command is not giving desired result. What will be right command for such situation?
12 years ago

dante cass wrote:



As others have already indicated, what you can do, I'll tell you where it is wrong. in your code, even if you enter your for loop, there are chances that if condition was never met, what will happen then?

It is better practice to have one return statement unless until you want to make your code more efficient in some particular situations, Like in a method if execution falls through varied conditions all with if statement, then you will likely to exit as sson as you met one of those. In if..else style, anyway you will exit, if one of hem is met.
12 years ago
initialized at loading time and declaring a variable of class level does not prevent it from being reassigned, however final has different meaning, it does not insist on initializing at load, One more property...left to you!
12 years ago
Those wrapper classes are immutable.
12 years ago
what is the compilation error? Problem here looks like variable scoping.
12 years ago
What is the difference when I get servletContext from getServletContext() and from request.getSession().getServletContext()?
12 years ago

Bear Bibeault wrote:Log4J


If I will put logger in my simpleController class, which takes action based on requested jsp, will it be enough to log stated exceptions. BTW, I've already logger configured, though exceptions caught are standard one (IOException and ServletException). Do you think, if I will use "throws NullPointerException or OutOfMemoryError", it will be logged or say catch them and log the stacktrace, it will solve the purpose. Well I've tried with NullPointerException (thrown and catched), but there was no logging in my log4J. Only logging is in tomcat logger ("localhost....") and that is every time irrespective of logger configured or not.
12 years ago
Sometimes due to internal engine or java heap space or null pointer exception, jsp page shows the complete stack trace. So I configured the error page, registered that in web.xml through <error-page> tag. But I want those error to be logged in my designated log file or better email to me. How to do that? Please help me.
12 years ago
Strings are good keys because that class is immutable. You can make any class immutable and use it as a key without doubt. So, foo is not good because it is mutable class and with changing values of its fields, its hashcode will change making it altogether different key.
12 years ago
what about set operations like retainAll and removeAll
12 years ago

Rahul.p Kumar wrote:Thanks Tingeling.

Michele too.
12 years ago

uj nossnahoj wrote:

the compiler treats it as if it were,

class Myclass extends Object {}

And in fact you can actually extend Object explicitly like above if you want to.



implicitly or explicitly, if Object is extended, how we are able to extend one more class? Say class A extends B{ } how it is possible that A also extends Object implicitly?
12 years ago
you can get keyset of map keys by calling its keySet()
12 years ago