devxlogo

Tip Bank

How to calculate sqrt()

Question: How do you calculate sqrt()? Answer: Of course the best way to compute square roots is to useMath.sqrt(),but I assume your question is academic. I’m not sure of the

How to Prevent Simultaneous Access

Question: How do you lock a file in Java to prevent simultaneous multipleaccesses? Answer: If you’re concerned about simultaneous access by independent processes,you’ll have to rely on the host OS

What is the Thread.interrupt()method’s purpose?

Question: What is the purpose of the Thread.interrupt()method? I expect that if I call the interrupt()method of a sleeping thread, anInterruptedException will be thrown. Here is aquick code sample showing

Reading from URL into String

Question: What is the maximum size of a string array I can have in my applet?I am trying to store some stock prices in a string array after reading themfrom

Launching Another Application from Java

Question: Is it possible to launch another application from aJava application (not an applet)? Answer: Yes. There are two classes of interest for performingsystem level functions such as this: java.lang.Runtime

Passing Data Between Two Threads

Question: I am new to Java and am currently trying toassociate idioms and techniques from otherlanguages/environments with like capabilities inJava. Specifically, I am trying to determine howto perform inter-thread and