This commit is contained in:
ldy
2026-03-01 23:18:55 -05:00
commit 67f753a5d1
3087 changed files with 218259 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question 8</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

Binary file not shown.

View File

@@ -0,0 +1,23 @@
import java.util.Scanner;
public class TestPalindrome {
public static void main(String[] args) {
System.out.print("Please input a word: ");
try(Scanner input = new Scanner(System.in)){
String str = input.next();
str = str.toLowerCase();
int begin = 0, end = str.length()-1, flag = 0;
while(begin != end) {
if(str.charAt(begin) != str.charAt(end)) {
flag++;
break;
}
begin++;
end--;
}
System.out.println((flag == 1) ? ("The word is not a palindrome.") : ("The word is a palindrome."));
}
}
}