1.
public class animal { String anme="dongwu"; public void work(){ System.out.println("animal...."); } } class dog extends animal{ @Override public void work() { System.out.println("dog....."); } } class cat extends animal{ @Override public void work() { System.out.println("cat....."); } } class text{ public static void main(String[] args) { //多态调用 animal a=new dog(); System.out.println(a.anme); a.work(); } }
2.
int main()
{
int i = 0;
int arr[10] = { 0 };
for (i = 0;i < 10;i++)
{
arr[i] = i;
}
for (i = 0;i <= 10;i++)
{
printf("%d\n", i);
}
return 0;
}