gpt4 book ai didi

java - 如何修复不兼容的类型错误

转载 作者:行者123 更新时间:2023-12-01 07:05:21 25 4
gpt4 key购买 nike

我有两个 printf,它们是分开的,因为其中一个正在循环,我在对齐其中一个 printf 时遇到问题。我希望它能排在 friend 下面。

什么是打印

Member                     Friends             
Chi Cho Joe Blow
Jimmy Brown
Status:

Joe Blow John Ko
Status: Coding like a friend

Tammy Joe Joe Johnson
Status: this is great

Bing Smith John Brown
Status: This sucks

我想要得到什么

Member                     Friends             
Chi Cho Joe Blow
Jimmy Brown
Status:

Joe Blow John Ko
Status: Coding like a friend

Tammy Joe Joe Johnson
Status: this is great

Bing Smith John Brown
Status: This sucks
<小时/>
    for (int i = 0 ; i< profiles; i++)
{
String arrayName = face.get(i).getName();
String statusName = face.get(i).getStatus();

LinkedList<String> linkName = face.get(i).getFriend();
String realname ="";
System.out.printf("%-20s", arrayName);

for (String toname : linkName) {
System.out.printf("%-20s", toname);
System.out.println();

错误所在

<小时/>
if (toname != linkName.size() - 1) {
System.out.printf("%-20s", "");
}
}
<小时/>
    System.out.println("Status: " + statusName);
System.out.println();
}
}

最佳答案

它在列表中称为 size() :) check here

关于java - 如何修复不兼容的类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26528604/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com