something like this,
class c1
{
class c2
{
public void printClassName()
{
c1 obj=new c1();
obj.printClassName();
}
}
public void printClassName()
{
System.out.println("Class 1");
}
public void accessingNewClass()
{
c2 obj=new c2();
obj.printClassName();
}
}