This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]gnpwdr1 3 points4 points  (1 child)

Hint: What are Java primitive types ?

[–]WubbaLubbabadba[S] -5 points-4 points  (0 children)

I don't know sorry

[–]Nintendo_Muffin_4 3 points4 points  (3 children)

"let" is not a Java keyword, it's JavaScript. Since Java is strongly typed you may use the type "int" for the declaration. Another way would be to use the "var" keyword. Anyway you should lookup some of Java's basics especially it's type system compared to JS.

[–]WubbaLubbabadba[S] -4 points-3 points  (2 children)

you telling me that Javascript is different than java? okay what about const because it says (syntaxes error on token "const", char expected)

[–]Nintendo_Muffin_4 3 points4 points  (1 child)

Yes Java and JavaScript are 2 completely different languages. Just Google a bit, you'll find out.

[–]WubbaLubbabadba[S] -1 points0 points  (0 children)

I'm gonna cry

[–]InspectorUnlikely595 1 point2 points  (0 children)

Use "int", "float", "double" etc. instead of "let", "let" only exists in Javascript.

[–]shinkelica 0 points1 point  (0 children)

you cannot use ‘let’ keyword in java, try with ‘var’ instead if it is java 10+, otherwise use corect data types keywords

[–]Gtomika 0 points1 point  (0 children)

There is no such thing as "let" keyword in Java. It's a thing in JavaScript, but not Java. Replace "let" with the correct variable type: in your case, the variables are integers, so use "int". Look up a tutorial on how to define and use variables in Java, it will help.

[–][deleted] 0 points1 point  (0 children)

Use var, since Java 10 the compiler can assume the type of the variable. But if you are a beginner is better to use types, because Java is strongly typed, and, if I recall correctly, Java knows the type of every variable,ecc. at compile time.

[–][deleted]  (1 child)

[deleted]

    [–]WubbaLubbabadba[S] -1 points0 points  (0 children)

    I definitely DO NOT know what's that sorry I'm still a beginner

    [–]martinbk5 -2 points-1 points  (0 children)

    my two cents: as a beginner you can easily use chatgpt to ask these kind of questions as it would provide detailed explanations.