Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
Multiple markers at this line
- The value of the local variable people is not used
- No enclosing instance of type TestExtends is accessible. Must qualify the allocation with an enclosing instance of type
TestExtends (e.g. x.new A() where x is an instance of TestExtends).
Solution: see if the class is written in another class
For example
public class TestExtends {
public static void main(String[] args) {
human people = new human();
}
class human{
String name;
}
}
The correct writing should be
public class TestExtends {
public static void main(String[] args) {
human people = new human();
}
}
class human{
String name;
}
This is a common mistake when learning object-oriented, hereby record QAQ
Similar Posts:
- [Problems with the use of internal classes] No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclo
- Java error: No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- [Two Solutions] non-static method xxx() cannot be referenced from a static context
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- Convert Object to List>, avoiding Unchecked cast: ‘java.lang.Object’ to ‘java.util.List
- [Solved] Java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
- Is not an enclosing class appears in creating a Java class
- Solution to the problem of Java program “resource leak: ‘SC’ is never closed” in vscode
- C# String was not recognized as a valid DateTime [How to Solve]
- Eclipse Error:The selection cannot be launched, and there are no recent launches