Java Course

class Vehicle
{
public void makeHorn()
{
System.out.println("Beep");
}
}

class Program
{
public static void main (String [] args)
{
Vehicle v1 = new Vehicle()
{
@Override public void makeHorn()
{
System.out.println("Beep beep");
}
};

Vehicle v2 = new Vehicle();
v1.makeHorn();
v2.makeHorn();
}
}



Dodaj komentarz






Dodaj

© 2013-2024 PRV.pl
Strona została stworzona kreatorem stron w serwisie PRV.pl