java 字符串无法解析为类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3877832/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 03:48:39 来源:igfitidea点击:
string cannot be resolved to a type
提问by chief
I am getting a "string cannot be resolved to a type" error in my code.
我的代码中出现“字符串无法解析为类型”错误。
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
FormLetter template;
template = new FormLetter();
template.print();
template.composeFormLetter(Sean, Colbert, God);
template.print();
}
}
class FormLetter
{
public void print(){
System.out.println(to + candidate + from);
}
public void composeFormLetter(string t, string c, string f){
to = t;
candidate = c;
from = f;
}
private string to;
private string candidate;
private string from;
}
回答by jjnguy
String
is capitalized in Java. You cannot use lowercase string
. (That's C#)
String
在 Java 中大写。不能使用小写string
。(那是 C#)
Side question:
How is the following compiling at all?
附带问题:
以下内容是如何编译的?
template.composeFormLetter(Sean, Colbert, God);