How can i know what is the execution time taken for completing an operation .
My query is that for example I am fetching data from DataBase and it can be done using Statements and PreperaedStatements also know , so i want to know what is the time taken when using Statements and what time in case of PreparedStatements .
Oh, you want a Java profiling tool! Let me google that for you: java profiler. Hmm, I did not see VisualVM mentioned in the results (I probably missed it).
You can always use the getTime() method of the Date class. This can be used as a quick and dirty millisecond timer. it returns a value of type long. So taking two measurements and substracting the first from the second gives you elapsed time in milliseconds.
It's not a replacement for a proper profiling tool I guess. Just a quick and easy time check.