Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

vishal mishra

Ranch Hand
+ Follow
since Jul 12, 2010
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 vishal mishra

Ivan Jozsef Balazs wrote:Why do you need an instance of the class as a member? Where does the variable ip get a value?

public class IpScanner {
IpScanner ip;

System.out.print(80+" port is open" +new IpScanner().ip.toString());

ip is null, invoking toString() against it is asking for trouble.

There is a proverb in my native tongue (Hungarian) which literally translates to "To shoot with a (big calibre) gun on a sparrow".
Who knows why this came to my mind...

This program was coded for different purpose.

I have mutated it just for watching the different behavior of JVM, when it uses JIT ans when it doesn't .
6 years ago

Ulf Dittmer wrote:Not sure where you got "java.compiler=none" from; the way to turn off the JIT is to start the JVM via "java -Xint ...".

Note that the JIT is a part of the JVM, and while you can explicitly turn it off (in the way I mentioned), whether or not it is used is up to the JVM (meaning, you can't force it to be used). Some methods will be JITed, and some may not be; that is up to the JVM (which gathers extensive statistics about class and method usage in order to determine whether it should or should not JIT a piece of code).

But all this goes way beyond what a beginner should concern himself with. It is just as likely to confuse you as it is to make things clearer.

Thanks for explaining me about JIT, I have searched through various sources in the net but nowhere it is specifically mentioned that JIT is a part of each version of JDK thanks for mentioning this.

Following is the source where i have read about command "java -Djava.compiler=none" for turning off JIT

One last question:-

Does stack trace produced JVM using JIT contains line numbers of source-code ?

6 years ago

Ulf Dittmer wrote:Not sure what you conclude that from. A JIT has been part of all JVM releases for about 15 years, give or take.

Well....I am still at the Beginner's level of java programing, trying to learn more....

I just want to experience the difference or to observe the difference in execution of java program by using JIT compiler and without using JIT i.e. turning off JIT compiler by using command

"java -Djava.compiler=none"
I have read somewhere that there is difference between stack trace produce by JIT and the stack trace produce by JVM
But not able to find any difference on executing the following program first by command java IpScanner, secondly by command "java -Djava.compiler=none IpScanner" and throwing NullPointerException

Thank you
6 years ago

Ivan Jozsef Balazs wrote:

Is there any difference between stack trace of JIT and JVM interpreter?

If the stack trace is not complete due to some parts getting replaced by something like ".. compiled code" then yes.
You'll recognize it when you see it.

JIT is not something you should usually be worried about too much.

Thanks for your quick reply:)

I have jdk1.7.0_02 that means JIT is not included.

Thank you
6 years ago
Namaste Friends !!

I have already asked question about JIT and I thought my doubt is clear but it is not so.

I have Jdk 1.7 installed on my system.

Please tell me whether JIT is included in jdk1.7 or not ?

Is there any difference between stack trace of JIT and JVM interpreter?

6 years ago

Jesper de Jong wrote:

vishal mishra wrote:I want to know when user compile .java file using javac command, is the file compiles using JIT compiler or simple java compiler.

javac compiles Java source code to Java bytecode. That does not have anything to do with the JIT compiler.

vishal mishra wrote:When JIT is used? How to use JIT ?

The JIT compiler is automatically used by the JVM when your program runs; it converts Java bytecode to native machine code, as the program runs.

vishal mishra wrote:Can we use it explicitly by typing some command ?

No. There is an option to switch JIT compilation off (-Xint), you use this when you run your program with the java command (not when compiling your program). Your program will run a lot slower if you do this. This option only exists for debugging, normally you should not use it.

Thanks for your valuable explanation:)
6 years ago
Namaste Friends !!

Please explain me is there any command for compiling program using JIT compiler or JVM takes care of it?

I know my question is not to the point...actually....I want to know when user compile .java file using javac command, is the file compiles using JIT compiler or simple java compiler.

When JIT is used? How to use JIT ?

Can we use it explicitly by typing some command ?

I have searched through net but not find any good please explain me...

6 years ago

Will Myers wrote:Why should we buy Whizzlabs exam simulator over the other offerings such as Enthuware?

My view is Exam-lab simulator is best of all.

Devaka Cooray wrote:Folks,

I am looking forward to coming up with a web-based version in addition to a new desktop version targeting the newer versions of Oracle exams. I will update you on this thread when it is happened. If you wish to download the last version existed, here is a direct link as a temporary solution.

[Edit: Finally, we did it - now it's on web. Just create an account on and start simulating the SCJP/OCPJP exam with a better Examlab]


PS- For those who are tiring trying to figure out what ExamLab is, it is an SCJP/OCPJP exam simulator with 360 mock questions with answers and explanations.

I was trying to SignUp but failed to do so.It is giving ERROR "We require every one use their real name"
Namaste Friends !!
I have passed OCPJP 6 but I answer for certain Questions.

I have received soft copy of oracle certificate, for hard copy Oracle is saying that I have to submit a request for its delivery.

My question is :

Isn't it Ok if I take out the print of this soft copy ?

What is the use of Oracle image ?

Please guide me..

Dhanyavaad Gaurang

I've read K & B twice attempted self test given at the end of every chapter took mock test using simulator provided in the CD comes with K & B book ,,certpal ,K & B practice test , Exam-Lab simulator

Every time logging errors and tried to learn more and more those topics through k and B book, coderanch, oracle docs.

About K & B practice test and Exam-Lab simulator


I've attempted 1st 3 test of both twice ,thrice and tried to achieve above 50 % in both of them.

Afterwards i've attempted both final tests ...

Thus I managed to get score 93 %.

Following resource also helped me a lot .
6 years ago
I took more than 1 year but finally i have passed......

Thank You CodeRanch, Thank You Java-Gurus, Thank You ALL Friends for helping me thanks !!

and further more Exam-Lab is the best mock-exam simulator ,thank you Devaka sir
6 years ago

Rajesh Chokkalingam wrote:Hello Dudes,

In K&B book page no 281, i am not understand following program and i'm not able to compile the program. I'm using java 7 to compile this program.

public class Bridge{
public enum Suits{
public int getValue(int bid){
return ((bid-1)*30)+40;
Suits(int points){
this.points = points;
private int points;
public int getVaue(int bid){
return points*bid;
public static void main(String[] args){
System.out.println(Suits.SPADES+" "+Suits.SPADES.points);

A. The output could contain 30
B. The output could contain @bf73fa
C. The output could contain DIAMONDS
D. Compilation fails due to an error on line 6
E. Compilation fails due to an error on line 7
F. Compilation fails due to an error on line 8
G. Compilation fails due to an error on line 9
H. Compilation fails due to an error within lines 12 to 14

Namaste Rajesh !!

Following resource Enum Constant specific body might help...
Namaste Friends !!

Page no. 798 of K & B book says -:

searching for class files, the java and javac commands don't search the current
directory by default

So why file compiles successfully with out "-classpath" option...

Here is the complete case-:

I have made two subdirectories in desktop dir named c and p

Subdir p contains file

Subdir c contains file

and when I tried to compile file from desktop dir using command javac c\ it compiles successfully please explain why ??

Here is the dir structure


Thank you Friends !! Got it !!