Java Overriding Part 2

What will happen when you try to compile the following code

class MyClass {
	static void foo() {}
	 }
class MySubclass extends MyClass {
	   @Override
	   static void foo() {}
}

 

What is the output of the following class ?

import java.io.IOException;
class Animal {
  public void eat() throws IOException {
	  System.out.println("All animal abstractcally eats");
  }
}

class Dog extends Animal {
  public void  eat() throws IOException {
	  System.out.println("Dog Eats");
  }
}

 class Cat  extends Animal {
  public void eat() { 
	  System.out.println("Cat eats");
  }
  public static void main(String a[]){
	  Animal animal=new Cat();
	  animal.eat();
  }
}

 

Check if the following code is a valid override

class MyClass {
  protected void add(int i, int ti) {
   // I will do later
  }
}

class MySubclass extends MyClass {
  private void add(int i, int ti) {
   // Will do now
  }
}