package com.codegym.task.task13.task1303;
/*
Don't mix beer with cola
*/
public class Solution {
public static void main(String[] args) throws Exception {
print(new Beer());
print(new Cola());
}
private static void print(Drink drink) {
System.out.println(drink.getClass().getSimpleName());
}
public interface Drink {
boolean isAlcoholic();
}
public static class Beer implements Drink{
boolean isAlcoholic(){
return true;
}
}
public static class Cola implements Drink{
boolean isAlcoholic(){
return false;
}
}
}
Please Help
Resolved
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Vlad Tifrea
22 April 2019, 13:28solution
add public before boolean in the colla and beer classes
+4
Satya Vath
22 April 2019, 13:31
Thanks Bro...
+1
Satya Vath
11 April 2019, 06:19
got two errors
0
// Java Poser
10 April 2019, 13:15
Cola is non alcoholic therefore it should return false
+1