I am trying to figure out why I get a compile error on the code below:
package com....;
public enum Something { //says error: <identifier> expected on this line
private String myInput;
public Something(String paramString) {
this.myInput = paramString;
}
public String getInputName() {
return this.myInput;
}
}
You have couple of problem with your enum declaration , first enum
constructor cannot be public and second you need to add ;
before private field. Eg
public enum Something {
;
private String myInput;
Something(String paramString) {
this.myInput = paramString;
}
public String getInputName() {
return this.myInput;
}
}
Since it seems you are not using enumerations, change "enum" to "class".
package com....;
public class Something {
private String myInput;
public Something(String paramString) {
this.myInput = paramString;
}
public String getInputName() {
return this.myInput;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.