Interfaces are Better Utilities (Than Classes) #airhacks #java #short

preview_player
Показать описание
Interfaces are better suitable for the implementation of "utility"-only functionality.

Рекомендации по теме
Комментарии
Автор

I'm learning lot at short time, thank you so much

kesav
Автор

You can use enums for utility classes. So no class can implement this.

enum Calculator {
;

static int add(int a, int b) {
return a + b;
}
}

mkrgl
Автор

is the main reason to write less code? or there are other pro or cons?

Muescha
Автор

Don't know why, but looks wrong to me. Interface -> implement it, thats my thinking.
But of course default methods are a good thing.

zickzack
Автор

we only need fat arrow like typescript to make it more short

sapito