HPARA-035 : String
This error occurs because the way you are declaring and initializing the `String` object is incorrect. In Java, you need to use double quotes (`"`) for defining strings. Here is the correct way to declare and initialize a `String`:
```java
String name = "John Doe";
```
If you want to declare a class with a `String` field, it should look like this:
```java
public class Person {
private String name;
public Person() {
this("John Doe");
}
public Person(String name) {
this.name = name;
}
}
```
In this example, the `Person` class has a `String` field called `name`. It has two constructors: one that initializes the `name` to a default value of "John Doe", and another that allows the client to set the `name` to a specific value.
```java
public class Person {
private String name;
public Person() {
this("John Doe");
}
public Person(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
}
2010年11月5日