basic java doubt ? access specifier ?
Hi
HERE is mu program .. it works fine no problem with that .. but it only compiles when i remove public specifier from the class " Horsetest" .. why is this happening ?? any ideas .. in c# if we declare like this program will execute no compile error .. why
Program :
public class HorseTest
{
public static void main (String [] args)
{
class Horse
{
public String name;
public Horse(String s)
{
name = s;
}
}
Object obj = new Horse("Zippo");
Horse h = (Horse) obj;
System.out.println(h.name);
}
}
please help me :) cheers