嘿伙计们,我是一个新手程序员,我得到了一个 .class 作为回报,但不知道它在问什么。任何帮助都会很棒,谢谢!
public static Letter[] addLetter(Letter[] array, Scanner kb)
{
Letter[] temp = new Letter[array.length + 1];
String toName, toAddress, toCity, toState, fromName, fromAddress, fromCity, fromState;
int toZip, fromZip;
double weight;
for (int x = 0; x < array.length; x++){
temp[x] = array[x];
System.out.print("New Letter:\nTo Name: ");
kb.nextLine();
System.out.print("To Street: ");
kb.nextLine();
System.out.print("To City: ");
kb.nextLine();
System.out.print("To State: ");
kb.nextLine();
System.out.print("To Zip: ");
kb.nextInt();
kb.nextLine();
System.out.print("From Name: ");
kb.nextLine();
System.out.print("From Street: ");
kb.nextLine();
System.out.print("From City: ");
kb.nextLine();
System.out.print("From State: ");
kb.nextLine();
System.out.print("From Zip: ");
kb.nextInt();
kb.nextLine();
System.out.print("Letter weight: ");
kb.nextDouble();
kb.nextLine();
Letter temp = new Letter(toName, toAddress, toCity, toState, toZip, fromName, fromAddress, fromCity, fromState, fromZip, weight);
int x = array.length - 1;
temp[x] = temp;
}
return temp[];
当我尝试返回 temp [] 时,它给了我一个错误。不太确定会发生什么让它做到这一点。
class' expected
return temp[];