Wednesday, March 4, 2009

we can override synchronized method



package mythread;

// we can override synchronized method with non-synchronized vice-verse

class Baseclass
{
public synchronized void sm()
{
System.out.println("super class");
}
}

public class SyncOverriding extends Baseclass{
public void sm()
{
System.out.println("sub class");
}
public static void main(String a[])
{
SyncOverriding s=new SyncOverriding();
s.sm(); // sub class
}
}


0 comments:

Post a Comment