m a begineer of java programing plz tel me wats wrong in my program.

// my first program
public class HelloWorld
{
public static void main(String[] args)
{
System.out.printIn("Hello World");
}
}

it shows the error cannot find symbol.
symbol:method PrintIn(java.lang.string)
location: class java.io.printstream
system.out.printIn("helloWorld")
1 error

Dani AI

Generated

A short, practical note for that builds on what and already pointed out.

The compiler error "cannot find symbol" means the compiler tried to resolve an exact name and signature and failed — the error shows both the symbol it looked for and where it looked (the class). That output is the fastest clue: it usually indicates a misspelling, wrong capitalization, or a method/field that does not exist on that type. The Java Language Specification explains that identifiers are case-sensitive, so a single wrong character will make the compiler treat the name as a different symbol (see the JLS on lexical structure) [https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html].

Practical checklist to get a working build

  • Re-check the exact method name and parameter types against the API the compiler mentions; the standard output stream methods are documented in the PrintStream API [https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html].
  • Save the source in a .java file and compile from the project root with the javac tool; run with the java launcher using the class name (watch package declarations if present).
  • If a top-level type is declared public, the filename must match that public type; otherwise the compiler will refuse to find the class when you try to run it.
  • Use a modern editor or IDE (autocompletion and instant error highlighting prevent this class of typo). Also use a monospaced font so characters like uppercase I and lowercase l are easy to tell apart.

If the error persists, paste the full compiler output (symbol and location lines) and the smallest reproducible source file into a new compile attempt; the two lines the compiler prints normally show exactly which token to fix.

Recommended Answers

All 2 Replies

All Java words are case-sensitive and have to be spelled exactly correctly, so Println is not the same as println.
In your code you have printIn.
The correct version is println

Ensure that your class name and your saved file(.java) should be exactly matches with each other...you have to import the necessary packages....Also java is a case sensitive so you have to learn about that

Note:In your pgm output statement as System.out.printIn("Hello World");
You have to correct it to System.out.println("Hello World");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.