public class Test extends Thread { static int count = 0; public static void main(String argv[]) { Test t = new Test (); t.increment(count); t.start(); Thread.sleep(1000); System.out.println(count); } public void increment(int count) { ++count; } public void run() { count = count + 5; } }
static int count = 0;
public static void main(String argv[]) {
Test t = new Test ();
t.increment(count);
t.start();
Thread.sleep(1000);
System.out.println(count);
}
public void increment(int count) {
++count;
public void run() {
count = count + 5;
Oracle Certified Professional Java Programmer
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.