在函数原型它显示一个错误 [英] In a function prototype it shows an error
本文介绍了在函数原型它显示一个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这表明无法找到symbol-类字符串
我写了一份报告卡的程序。此功能是接受的名字。请帮助
公共静态字符串accept_name(){
字符串str [] =新的String [40];
的System.out.println(请输入40名学生的名字);
对于(int类型的= 0; A< = 39; A ++){
STR [α] = br.readLine();
}
返回(STR);
}
解决方案
使用字符串
不是字符串
。
Java类型区分大小写。
另外,你声明的返回类型为字符串
,但你实际上返回 STR
这类型的的String []
(字符串
S)。
您需要返回类型更改为的String []
,或决定哪些字符串
返回。
it shows cannot find symbol- class string I am writing a program for a report card. This function is to accept names. Pls help
public static string accept_name() {
String STR[]=new String[40];
System.out.println("Enter 40 students names");
for(int a=0;a<=39;a++) {
STR[a]=br.readLine();
}
return (STR);
}
解决方案
Use String
not string
.
Java types are case sensitive.
Also, you declare return type is String
, but you actually returns STR
which is of type String[]
(array of String
s).
You need to change the return type to String[]
, or decide which String
to return.
这篇关于在函数原型它显示一个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文