/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javathread;
/**
*
* @author Arif CEYLAN
*/
public class JavaThread {
private int a=4;
private int b=0;
private int c=0;
public class thr1 extends Thread
{
public void run()
{
if(a<0)
{
c=b-a;
}
else
{
c=b+a;
}
}
}
public class thr2 extends Thread
{
public void run()
{
b=10;
a=-3;
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JavaThread jt=new JavaThread();
Thread tr1=jt.new thr1();
Thread tr2=jt.new thr2();
tr1.run();
tr2.run();
System.out.println("a'nın değeri:"+jt.a+",bnin değeri:"+jt.b+",c'nin değeri:"+jt.c);
}
}