谁能告诉我哪一部分输出any
符号前面的数字?是方法还是输出?
import Autosuggest, { ItemAdapter } from 'react-bootstrap-autosuggest'
<Autosuggest
datalist={this.state.formData.cname.list}
itemAdapter={CustomerListAdaptor.instance}
placeholder="Enter CustomerName"
valueIsItem={true}
value={this.getInputValFromCustomSources('cname')}
onChange={ (val) => this.autuSuggestionControls.onChange(val, 'cname') }
ref = {(domElm) => { this.domElmns.cname = domElm; }}
onKeyUp = {(e) => this.handleKeyUp(e, {currElmKey: 'cname', isCustomerNameInput: true}) }
// onSelect = {(param) => this.autuSuggestionControls.onInputSelect(param, 'cname')}
inputSelect = {(e) => this.autuSuggestionControls.inputSelect(e)}
readOnly={this.props.billCreation.loading}
/>
答案 0 :(得分:0)
您正在打印从方法返回的数字。您可以像这样更改它,以免打印该方法的返回值,
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter number");
int number = sc.nextInt();
int i = 1;
while (i <= number) {
printLine(number);
System.out.println();
number--;
}
i++;
}
public static int printLine(int number) {
for (int j = 1; j <= number; j++) {
System.out.print("*");
}
return number;
}
}
这是您打印方法返回的数字的部分,
System.out.println(printLine(number));
您还可以将该方法的类型更改为void,因为您无需返回该值