why this error come from cmd
sublime
public class helloWorld{
public static void main(string[] args){
system.out.println("hello world! It's me malitha!");
}
}
cmd ,
C:\Users\user\Desktop\linkedin\java\java>javac helloWorld.java helloWorld.java:3: error: cannot find symbol public static void main(string[] args){ ^ symbol: class string location: class helloWorld helloWorld.java:4: error: package system does not exist system.out.println("hello world! It's me malitha!"); ^ 2 errors
Hello! 3Line string[] → String 4Line system → System Uppercase and lowercase letters are judged separately.
Wrong Syntax and Capitalize The String
Correct Code.
public static void main(String[] args) { system.out.println("hello world, it's me Matilda"); }
Code :
public static void main(String[] args) { System.out.println("hello world! It's me malitha!"); }
Also calitalize the word String
Correct Code:
public class helloWorld{ public static void main(String[] args){ System.out.println(" hello world! It's me malitha!"); } }
Java is case-sensitive ,so its important to pay attention to the casing of your variables, class names, and important statements. so here in your code capitalize the String-S and also the System-S.
The errors in your Java program are due to some syntax and case sensitivity issues. Here's the corrected code:
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world! It's me Malitha!"); } }
**Let's go over the corrections:
The class name should start with an uppercase letter. In this case, it should be "HelloWorld" instead of "helloWorld."
The main method should have a capital 'S' in "String" and proper capitalization.
The System class should also have a capital 'S,' and the println method should be called using System.out.println().
After making these changes, you should be able to compile and run your program without any errors.**