Mohit Mehta

+ Follow
since Jan 24, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mohit Mehta

  • Object z = t.findLarger(123, "456"); - It is not giving compile error as return type is Object class and ideally we can convert any object to Object class, but this statment will fail while running compateTo() method..
  • int m = t.findLarger(123, new Double(456)); - It will give compile time error as return type expected in int and we are passing one object of type Double() which cannot be type cast to int

  • int y = t.findLarger(123, new Integer(456)); -This should run perfectly
  • int x = (int) t.findLarger(new Double(123), new Double(456)); - It has same case as type casting...

  • if you remove all left side parameter i.e. Object z, int x etc. you will not get any complie time error.. so as per my understanding here return type compatiblity is checked at complie time

    ArrayIndexOutOfBounds and NullPointerException thrown by the JVM

    whereas IllegalArgumentException thrown by the application

    I don't think that ArrayIndexOutOfBounds and NullPointerException thrown ONLY by the JVM, you can check for Null value and throw same exception likewise IllegalArgumentException can be thrown by JVM also...

    all these 3 exception falls into RuntimeException categroy so usally we should expect it to be thrown by JVM.
    daisy lakhanpal
    I think you should go for SCJP 6.0 as Ankit mentioned before ... there only few new API class to read and on top of that most important thing is you will have latest ceritfication in Java.

    Even I was in same dilema one week back but after reading all post of Java Ranch and comparing things i have decided to go for SCJP 6.0

    Hope this helps
    Abhi Vijay :

    In case of go() method primitive int is auto-boxed to wrappered Integer.
    It will create new objects, for new objects == will return false as their memory location would be different, whereas if you try .equals() method it will return true

    I am very new to Spring MVC.
    I need some example or tutorial which talks about Spring MVC tags.
    Please provide me some links on that.

    Is this book available in India?

    Please let me know which publication will work in India?
    14 years ago
    This book is in form of Q&A.
    But Questions are discussed in great detail so if Intervieer ask any twist, you can address that also.
    In previous version all question was categorised based on its level say basic, advance etc.
    14 years ago

    I had chance to read review coppy of "Java/J2EE Job Interview Companion" by
    Arulkumaran Kumaraswamipillai & Sivayini Arulkumaran.

    I am not sure which edition it was. does current edition has question Categorized based on its level?

    Does this book give insight about following topics:
    1 How Serialization works? Serialization behaviour in Inheritance
    2 How HashMap or any other Collection Classes internally works?
    3 Is it addressing about Spring 2.3, Struts 2.0 or related basic questions?
    4 Most commonaly asked question comparision betn Spring MVC and Struts
    is it addressed in this book?

    As I mentioned before I got chance read few question and ans of this book in review copy, It was very much Precise and easy to understand, explanation given in book gives confidence in interview.
    If person manage to give answer as given in book, he can easily bag new job.

    Hope to get this book in Pune book stores.
    As previous edition was not available in book stores
    [ February 25, 2008: Message edited by: Mohit Mehta ]
    14 years ago
    Can you explain what is meant by multiple action class?

    Does that mean you want to call multiple action class for single url?
    15 years ago

    I came across one interview question.
    Question was

    How action class will handle each new request?
    A) For each request controller will create new instance of action class.
    B) Single instance will handle all request.
    C) instance creation is configurable in Struts-config.xml file.
    D) Multiple request will be handle by multiple instance.

    My knowledge says ans should be "B" as we think about controller is just servlet and servelt will have one instance with multiple thread running.

    Please give your comment.
    Correct me if i am wrong.

    Thank you in advance,
    15 years ago

    In our project we have one already created API which is called from Sevelet and we are passing PrintWriter object from Servlet to that API as follows

    PrintWriter out = resp.getWriter();


    Now internally this method doStuff() writes result in form of
    and control comes back to Servlet now Servlet forwards request,response to
    JSP page where We are doing some pagination and other activity and we need to show result written in PrintWriter stream by doStuff() method.

    How can we read and show data written in PrintWriter to our JSP page?
    Is there any other way to read PrintWriter stream content in JSP?

    15 years ago

    Please provide some JSP pagination method.
    I have checked pager-tag.
    If anyone has some example on that please
    let me know.

    Is there any other Tag lib to address pagination in JSP.

    15 years ago

    I have web appilcation which has 4 servlets.
    Presently all running on default port 8080.
    Can we configure this individual to run on different port?
    [ September 24, 2006: Message edited by: Ben Souther ]
    15 years ago
    Can web application have control on life cycle of servlet which is part of that application?
    15 years ago
    Thank a lot Ben.

    I deploy SimpleServlet.war. as you can see there we have entry for SimpleServlet in web.xml.

    Can you instantiate,load and unload this SimpleServlet without putting entry in web.xml?

    but here in our application those servlets as some 3rd party servlets
    that we allready have in side our appication but its instantiation and loading to application context should be in hand of application itself.

    and i mention before
    our URL address will be something like this

    to such servlet we are passing some or other parameters.

    Thanks once again Ben.

    Please keep sending your suggestion.
    15 years ago