Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion challenge1/Question1.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.challenge1;
package challenge1;

import java.util.HashMap;
import java.util.Map;
Expand Down
22 changes: 22 additions & 0 deletions challenge1/Question2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package challenge1;

public class Question2 {
static boolean isPalindrome(String testString) {
String reverse = "";

for (int i = 0; i < testString.length(); i++){
char c = testString.charAt(i);
reverse = c + reverse;
}

if (testString.equals(reverse)) { return true; }
else { return false; }
}

public static void main(String[] args) {
String testString = "bob";
String testString2 = "jeff";
System.out.println(isPalindrome(testString));
System.out.println(isPalindrome(testString2));
}
}