I just installed eclipse and wanted to write a java program to test whether it could be used. As soon as I ran, I got an error, and debug was the same error. The error content was: the selection cannot be launched, and there are no recent launches, I couldn’t find this
Here’s the code
1 package test;
2
3 public class test {
4
5 static void main(String[] arg)
6 {
7 System.out.println("Hello World");
8 }
9 }
We found that we need to add a public before static, and the s of string must be uppercase, and main must be spelled correctly. The corrected code is as follows
package test;
public class test {
public static void main(String[] arg)
{
System.out.println("Hello World");
}
}
Found can run, successfully output results Hello world
Similar Posts:
- [Two Solutions] non-static method xxx() cannot be referenced from a static context
- [Solved] Java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
- Java error: No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Solution to the problem of Java program “resource leak: ‘SC’ is never closed” in vscode
- [Solved] Exception in thread “main” java.util.ConcurrentModificationException
- [Problems with the use of internal classes] No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclo
- [Solved] Java Call Error: java.lang.IllegalArgumentException: wrong number of arguments
- Java – Convert bytes to unsigned bytes
- Convert Object to List>, avoiding Unchecked cast: ‘java.lang.Object’ to ‘java.util.List
- [Solved] JAVA Beginners’ Error: Exception in thread “main“ java.io.FileNotFoundException