/* grade */
class place
{
public static void main(String args[])
{
String country="india" , state="ap", city="nellore";
if(country=="india")
{
System.out.print("you are in india");
if(state=="ap")
{
System.out.print(", ap state ");
if(city=="nellore")
{
System.out.println("at nellore city");
}
else
{
System.out.println("not in nellore ");
}
}
else
{
System.out.println("not in ap");
if(state=="up")
{
System.out.println("you are in up state");
}
}
}
else
{
System.out.println("you are not in india");
}
}
}
output :
you are in india , ap state at nellore city
class place
{
public static void main(String args[])
{
String country="india" , state="ap", city="nellore";
if(country=="india")
{
System.out.print("you are in india");
if(state=="ap")
{
System.out.print(", ap state ");
if(city=="nellore")
{
System.out.println("at nellore city");
}
else
{
System.out.println("not in nellore ");
}
}
else
{
System.out.println("not in ap");
if(state=="up")
{
System.out.println("you are in up state");
}
}
}
else
{
System.out.println("you are not in india");
}
}
}
output :
you are in india , ap state at nellore city