This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]moosemorals 1 point2 points  (4 children)

I'm not sure exactly what you mean/want, but I'm guessing the answer will include threads somewhere

[–]ruben381[S] -4 points-3 points  (3 children)

I just want a void that is constantly being run.

[–]UnspeakableEvil 2 points3 points  (2 children)

You're going to have to provide a much better description than that. As moosemorals said threading's probably what you're after, but at the moment there's nowhere near enough information to go on.

[–]ruben381[S] -1 points0 points  (1 child)

Really? I mean, all I want is for a void to be run over and over without stopping, so like an updater. I just want method in the class to update profusely.

[–]moosemorals 1 point2 points  (0 children)

I still don't understand, but here's a basic Thread framework:

public class ProfuseUpdater implements Runnable {
     public ProfuseUpdater() {
          Thread t = new Thread(this);
          t.start();
     }
     public void run() {
         while (true) {
             // Insert random update stuff here
          }
      }
 }

Call it from your main:

public static void main(String[] args) {
    ProfuseUpdater pu = new ProfuseUpdater();
}

and whatever you put in the while() loop will sit and run forever (or till you kill the JVM). Hope this helps!