First you need to correct the syntax for the method Price(), you forgot to use parenthesis just after the method name in both the classes.
Then you need to make the return value of Price() method in the class Ticket to an int value like 0 or 1. Because your return type is int and how can you return a null value. The code you have written won’t compile.
One more thing while creating methods start the name with lowercase letter that is the standard convention following in java.
Corrected code:
public class Ticket {
public int price(){ return 0;} }
public class RedTicket extends Ticket {
public int price { return 40; } }
Ticket t = new RedTicket();
int test = t.Price();
solved Unexpected issue with method overriding [closed]