Java Course

interface Vehicle
{
public void makeHorn();
public void makeEngineSound();
}

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


public void makeEngineSound()
{
System.out.println("Vroom vroom");
}
}


class Program
{

public static void main (String [] args)
{
CarOne c1 = new CarOne();
c1.makeHorn();
c1.makeEngineSound();
}
}



Dodaj komentarz






Dodaj

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