Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- String product = scanner.nextLine();
- if (product.equals("banana") || product.equals("apple") || product.equals("kiwi") || product.equals("cherry") || product.equals("lemon") || product.equals("grapes")) {
- System.out.print("fruit");
- } else if (product.equals("tomato") || product.equals("cucumber") || product.equals("pepper") || product.equals("carrot")) {
- System.out.print("vegetable");
- } else {
- System.out.print("unknown");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement