Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

Piyush Joshi

Ranch Hand
+ Follow
since Jun 10, 2011
Piyush likes ...
Eclipse IDE Firefox Browser jQuery
Having experience of 1.5 years in java and software development now, and I think there is hell lot to learn. Worked at Tata Consultancy Services and MakeMyTrip.com as a Software Developer.
Bangalore, India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
36
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Piyush Joshi

One compelling reason for enterprise applications to move to Java 7 might be its new G1 garbage collector, which seems quite promising for applications with huge memory.

Our current web application is running poorly even on 6 GB heap size, now with Java 7 we are expecting it to perform better. Lets see how it turns out to be....

One more rather trivial observation was in terms of reduction of build times. With JDK 6 it was taking around 3 mins for our application to build, but with JDK 7 it takes around 20 secs :O .
6 years ago
with synchronized chat method only one thread will be able to invoke this method (on static Dudes object d) at a time. Second thread will get a chance to invoke chat only when first chat call returns.
First chat call sets the static flag equal to thread id and then prints "yo" two times. then second thread invokes chat and prints "dudes" two times, and given the above logic second method call can not be made unless first finishes so output will always be "yo yo dude dude"
Its a really bad practice to use scriptlets in JSP.
Use jstl tags. especially foreach tag will help you most in this case.
6 years ago
JSP
because you are defining it as multidimensional...
int[] a = null,b[] = null;
means:
int[] b[] = null;
which in turn means:
int[][] b = null;

now you see the difference..
Not specifically with respect to exam.. but this Oracle's tutorial is very good source for better understanding regular expressions.
very true...
I was also planning to get OCMJD certification, but checked the Oracle site and total price it would take is huge... Now I think it will be better to go for Java EE 6 certifications which do not require any mandatory training. But is this exam really worth spending this much money?
Download Servlet Specification and refer to it.
6 years ago
Hi Yogesh,
Can you please elaborate this example.

I don't see in this scenario how interchangeability of behaviors can be implemented. You call a party loving friend when you want to party, and gang up with your adventurous friends when you want to go for a trip. Here your needs or scenarios are different, one is party and second is adventure trip. But if you consider one particular scenario then you can not interchange a party loving friend with adventurous friend.
Relative and absolute paths are related to the request URL, not to the actual location of that resource in the web application.
JRE version of JVM, that container uses to run, can be changed as needed (Just set the JAVA_HOME environment variable).
In exam you can assume that Java EE5 container runs Java SE5 JVM, so the autoboxing will work.
1) of course it will work. Java EE 6 is built on top of Java SE 6.
2) wrong.
Option "a" is wrong because url rewriting does not happen automatically.
Option "b" is correct because this is what getSession() does.
Option "c" is correct because container is required to support cookies as session tracking mechanism.
yes you are right! I tried it in tomcat 7.
I think its a bug in Tomcat.

But you have seen what's there in specification, so you are clear from the point of view of exam.
Are you sure? In your first post you said that second.jsp was the result, which is as expected:

Ankur Gargg wrote:
I tried on tomcat 6 it gives me result as second.jsp.

To look for the answers of these kind of questions you should refer to Servlet specification. If you go to page 126 of specification it says:

The Web application may have declared error pages using the exception-type
element. In this case the container matches the exception type by comparing the
exception thrown with the list of error-page definitions that use the exception-type
element. A match results in the container returning the resource indicated in the
location entry. The closest match in the class hierarchy wins.



So closest match here in your case is ArithmaticException so it wins! thats it.
I have no idea about MyBatis but for books: "Java Persistence with Hibernate" is the best book you can read to learn Hibernate in depth.