Java Java Basics Getting Started with Java Strings and Variables

Dylan Anderton
Dylan Anderton
8,163 Points

Error: cannot find symbol

Update: derp... simple mistake.

I copied the code from the video but still receive this error. It can't find the period in the console.printf method? Any help for this one?

import java.io.Console;

public class Introductions {

public static void main(String[] args) {
    Console console = System.console();
    // Welcome to the Introductions program!  Your code goes below here

  console.prinf("Hello World!");

} }

Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
Introductions.java:9: error: cannot find symbol
console.printf("Hello World!");
^
symbol: method prinf(String)
location: variable console of type Console
1 error

2 Answers

saykin
saykin
9,820 Points

Hi, there is an spelling error in your console.printf line. You're missing the letter 't'.

Dylan Anderton
Dylan Anderton
8,163 Points

Wow... Derp. Thank you, ugh. xD

saykin
saykin
9,820 Points

Happens to the best of us, in the future, look at the error message, it will save you a lot of headache when it comes to compilation errors.

It says:

Introductions.java:9:error: cannot find symbol
console.printf("Hello World!");
^
symbol: method prinf(String)

The error was at line 9 in file/class Introductions.java and that it couldn't find the symbol on that line, which basically means it can't find the method/variable prinf(String). So either spelling error or you haven't linked some other file/class that has the method/variable.

Dylan Anderton
Dylan Anderton
8,163 Points

Thank you for this tip, I will use this in the future!