简体   繁体   English

字符串无法解析为类型

[英]string cannot be resolved to a type

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;

  }

String is capitalized in Java. String用Java大写。 You cannot use lowercase string . 您不能使用小写string (That's C#) (这是C#)

Side question: 附带问题:
How is the following compiling at all? 以下内容如何编译?

template.composeFormLetter(Sean, Colbert, God);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM