3 回答

TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個(gè)贊
試試這個(gè)
public static void main(String[] args) {
if (!Customer.findCustomer(customers, input, true).equalsIgnoreCase("eee")) {
do something
}
}

TA貢獻(xiàn)1826條經(jīng)驗(yàn) 獲得超6個(gè)贊
只需將結(jié)果分配給這樣的變量
public static void main( String[] args ){
value = Customer.findCustomer(customers,input,true);
if(value returned !="eee"){ /*do something*/ }
除了你需要設(shè)置客戶,并且輸入等于什么第一。
public static void main( String[] args ){
input = 'test';
customers = new Customer[];
value = Customer.findCustomer(customers,input,true);
if(value returned !="eee"){ /*do something*/ }

TA貢獻(xiàn)1111條經(jīng)驗(yàn) 獲得超0個(gè)贊
創(chuàng)建一個(gè)變量(引用 String 類(lèi)型,以便它可以引用 String 對(duì)象)并用于賦值返回的字符串對(duì)象?,F(xiàn)在使用運(yùn)算符(即=.
public static void main( String[] args ){
String retValue = Customer.findCustomer(customers,input,true);
if(retValue.equals("eee"){
//do processing
}
}
對(duì)于參考,您可以看到參考和對(duì)象以及運(yùn)算符的答案參考答案=
添加回答
舉報(bào)