learning-java-2825378 icon indicating copy to clipboard operation
learning-java-2825378 copied to clipboard

why this error come from cmd

Open malithaofficail opened this issue 3 years ago • 5 comments

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

malithaofficail avatar Dec 23 '22 20:12 malithaofficail

Hello! 3Line string[] → String 4Line  system → System Uppercase and lowercase letters are judged separately.

mgiita avatar Feb 27 '23 00:02 mgiita

Wrong Syntax and Capitalize The String

Correct Code.

public static void main(String[] args) { system.out.println("hello world, it's me Matilda"); }

MarleySetwaba avatar Mar 11 '23 19:03 MarleySetwaba

Code :

public static void main(String[] args) { System.out.println("hello world! It's me malitha!"); }

Also calitalize the word String

Rishabh-Ethicalhacker avatar Jul 28 '23 16:07 Rishabh-Ethicalhacker

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.

krushnapriyadas avatar Aug 23 '23 05:08 krushnapriyadas

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.**

jeetu-g2-1 avatar Oct 25 '23 06:10 jeetu-g2-1