Untitled
unknown
plain_text
2 years ago
2.5 kB
9
Indexable
class Singer {
void sing() {
System.out.println("random song");
}
}
class Tahsan extends Singer {
@Override
void sing() {
System.out.println("Sei Tumi Keno Eto Ochena Hole");
}
}
class Arnob extends Singer {
@Override
void sing() {
System.out.println("She Je Boshe Ache");
}
}
abstract class Vehicle {
int length;
int weight;
double price;
abstract void accelerate();
abstract void brake();
}
class Bus extends Vehicle {
@Override
void accelerate() {
System.out.println("Bus is accelerating.");
}
@Override
void brake() {
System.out.println("Bus is braking.");
}
}
class Truck extends Vehicle {
@Override
void accelerate() {
System.out.println("Truck is accelerating.");
}
@Override
void brake() {
System.out.println("Truck is braking.");
}
}
abstract class Flower {
String color;
String smell;
double price;
abstract void gift();
abstract void buy();
}
class Rose extends Flower {
@Override
void gift() {
System.out.println("A " + color + " rose is a great gift!");
}
@Override
void buy() {
System.out.println("A " + color + " rose costs $" + price + ".");
}
}
class Marigold extends Flower {
@Override
void gift() {
System.out.println("A " + color + " marigold is a thoughtful gift!");
}
@Override
void buy() {
System.out.println("A " + color + " marigold costs $" + price + ".");
}
}
class Shape {
void printShape() {
System.out.println("This is a shape.");
}
}
class Rectangle extends Shape {
@Override
void printShape() {
System.out.println("This is a rectangular shape.");
}
}
class Circle extends Shape {
@Override
void printShape() {
System.out.println("This is a circular shape.");
}
}
class Square extends Rectangle {
void printShape() {
System.out.println("Square is a rectangle.");
}
}
public class Client {
public static void main(String[] args) {
Color v = new Red();
v.doColor();
}
}
class Color {
void doColor() {
System.out.println("Color");
}
}
class Red extends Color {
@Override
void doColor() {
System.out.println("Red Color");
}
}
Editor is loading...
Leave a Comment