Hi !my doubts are based on below programme.
------------------------------------------------------------------
------------------------------------------class C implements Runnable { public void f1() { System.out.println("Hi"); } public void run() { f1(); } synchronized void f2() { System.out.println("Hello"); } } class synchronized { public static void main (String args[]) { C c1=new C(); Thread t1=new Thread(c1); Thread t2=new Thread(c1); t1.start(); t2.start(); } }
Here c1 is object of class C.
I have accessed method f1 of object c1 by threads t1 and t2.
My Doubt:
I want to access method f1 by thread t1 and f2 by thread t2.
Is it possible?
If possible please tell me