If multiple cores are available on a given processor, will they be utilized automatically when JVM runs a java code written by user? Or the code will have to be specifically
As far as I know, the JVM does take advantage if the option exists. If you run the profiler tool: java/jdk[version]/bin/jvisualvm.exe you can observe how even a normal, "singled threaded" program makes use of multiple threads. I can't recall offhand if the profiler shows which cores are used for the given threads, though.
It's possible in java to take advantage of multi-core utilization, by creating separate threads. Unlike earlier implementations of JVM, modern implementations create native threads, which OS can recognize and thus, each available processor can be allocated to each thread created in running java program. But, that doesn't mean that you will always get the advantage of multiprocessing(multi-core utilization). It depends upon the problem and moreover, the way solution is designed. Improperly designed solutions doesn't take the advantage of multi-core processing.
NOTE :- My suggestion is, Highly computation intensive jobs have to be designed keeping parallel-computing(multi-core utilization) architecture in mind. Modern CPUs have reached the maximum limit of increasing CPU clock frequency. Thus, companies like Intel are designing CPUs which have multi-cores. Thus, It's the responsiblity of developer to write software to take advantage of multi-core abilities of processor.