String, text, numbers, I/O I part
long lCurrent = (new Date()).getTime();
while((lCurrent lStart < n*1000) && (Input.available()==0)){
    Thread.currentThread.sleep(100); /* This will give JVM time to other threads */
    lCurrent = (new Date()).getTime();
}
********************************************
You could simply count number of steps inside the loop keeping in mind that each
step takes 100ms but I think using dates would be a bit more precise method.
Alex Shlega
 Q: I tried to write a program where I imported the java.math.* package...But sin()
didn t work!
It looked something like this.
import java.math.*;
public class ...{
   public Fnx (double x){
      double answer = sin(x)   2;
      return answer;
   }
...
}
But sin() didn t work! I had to write Math.sin(), at which point I could just comment the
import statement out.
What am I doing wrong?
Answer: You re confusing what the import statement does, and what Math is.
Math is a class in the package java.lang, just as System is.
java.math is a package containing two classes: BigDecimal and BigInteger.
When you call Math.sin, you re using a class method in the Math *class*, just as
when you call System.out.println () you re using an instance variable called "out"
which belongs to the System class.
Your import statement merely means you can use BigDecimal and BigInteger without
prefixing them with java.math.   ie "new java.math.BigInteger()" becomes just "new
BigInteger".
You can t get away from putting Math.sin in your class.
   
Jon Skeet   http://www.pobox.com/~skeet
file:///F|/a_jsite/350_tips/stings_text__date_numbers_io I.htm (6 of 7) [2001 07 08 11:24:59]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved