aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-11-07 19:15:17 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-11-07 19:15:17 +0000
commitd0c94dedc2635ed4ff7e3fd0ac367ccc9c65d2ae (patch)
tree4f03b9e00bea36fe8b2057b2bf8deb32ac38deea
parentaa25cbb7ebeeaa3c24176d23ab311a23ec4f8b53 (diff)
downloadperlweeklychallenge-club-d0c94dedc2635ed4ff7e3fd0ac367ccc9c65d2ae.tar.gz
perlweeklychallenge-club-d0c94dedc2635ed4ff7e3fd0ac367ccc9c65d2ae.tar.bz2
perlweeklychallenge-club-d0c94dedc2635ed4ff7e3fd0ac367ccc9c65d2ae.zip
- Added guest contribution by Mohammad Meraj Zia.
-rw-r--r--challenge-190/ziameraj16/java/CapitalDetection.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-190/ziameraj16/java/CapitalDetection.java b/challenge-190/ziameraj16/java/CapitalDetection.java
new file mode 100644
index 0000000000..af7c9c30a8
--- /dev/null
+++ b/challenge-190/ziameraj16/java/CapitalDetection.java
@@ -0,0 +1,19 @@
+import java.util.Scanner;
+
+public class CapitalDetection {
+
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ System.out.println("Enter word");
+ String word = scanner.nextLine();
+ if (word.toUpperCase().equals(word)) {
+ System.out.println("Output: 1");
+ } else if (word.toLowerCase().equals(word)) {
+ System.out.println("Output: 1");
+ } else if (Character.isUpperCase(word.charAt(0)) && word.substring(1).toLowerCase().equals(word.substring(1))) {
+ System.out.println("Output: 1");
+ } else {
+ System.out.println("Output: 0");
+ }
+ }
+}