【发布时间】:2011-07-06 23:49:17
【问题描述】:
我想返回我的数组的值加上递归调用的返回值。
但是出于某种原因,java 不希望在构造函数之后有方法名称。
此外,当我尝试将方法转换为另一种方法时,使用 isPalindrome 时出现错误。
我更改了我的程序,但仍然出现错误。
public class isPalindrome
{
/**
* This is the main entry point for the application
* @return
*/
public static boolean main(String[] args)
{
String[] word = {"KayaK", "Desserts, I stressed"};
boolean isPalindrome(String[] array, String s, String i)
{
if(i.charAt(0) == s.charAt(0))
{
System.out.println("You entered a Palindrome");
return true;
}
else
{
System.out.println("You didn't entered a Palindrome");
}
}
try
{
System.in.read();
}
catch (Throwable t)
{
}
}
}
【问题讨论】:
-
数组应该代表什么?在 main 中,您将 s 用于字符串数组,但 isPalindrome 似乎没有将字符串数组用于任何内容。
标签: java arrays eclipse boolean