Trying to follow Javascript tutorials with intelliJ, can't get [] to work

I’m a beginner and I’ve been trying to practice the basic javascript tutorials from this site in intelliJ.
I can’t get the codes involving [ ] to work, even though they work in the freeCodeCamp tutorial. Do I need to change a setting in IntelliJ or should I use a different IDE.

I’m trying to make it print the first letter of “Lovelace”.

public static void main(String[] args) {
    var firstLetterOfLastName = "";
    var lastName = "Lovelace";

    firstLetterOfLastName = lastName[0];

    out.println(firstLetterOfLastName);

I don’t know IntelliJ, but it says it’s a “Java IDE.” Maybe it doesn’t have JavaScript in it? (note: Java and JavaScript are not the same language)

Maybe download Visual Studio Code , which is free and extremely popular, and give that a try.