Mishakis

Naming Conventions

Oct 15th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4.  
  5. public class Main {
  6.  
  7.  
  8.     public static void main(String[] args) {
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.         String word = scanner.nextLine();
  12.  
  13.         if (word == word.toLowerCase()) {
  14.             System.out.println("field");
  15.         } else if (word == word.toUpperCase()) {
  16.             System.out.println("constant");
  17.         }else if(word.matches("[A-Z][a-z]+") ){
  18.             System.out.println("pascal");
  19.         }else if(word.matches(("[a-z]+[A-Z]+"))){
  20.             System.out.println("elephant");
  21.         }else{
  22.             System.out.println("mismatch");
  23.         }
  24.  
  25.  
  26.  
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment