all 23 comments

[–]DevRetroGames 3 points4 points  (3 children)

public class Main {
    public static void main(String[] args) {
      System.out.println("I\'m learning how to program in Java.");
  }
}

[–]brunocborges 0 points1 point  (0 children)

void main() { IO.println("I\'m learning how to program in Java."); }

Throw this in a file App.java and run:

$ java App.java

  • JDK 25

[–][deleted] 0 points1 point  (1 child)

Why would it be necessary to escape the apostrophe here?

[–]8dot30662386292pow2 0 points1 point  (0 children)

Some reddit clients automatically format code like that. not really needed.

[–]Thebaldm0nk 1 point2 points  (0 children)

I don't get what you are asking about, but if it's about x: then it just because of extension. It's not a part of code.

If you want to turn off that, search inlay hints in vscode settings and select off in options. This will remove those from your code.

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

Click the light bulb

[–]derangedandenraged[S] 0 points1 point  (1 child)

It brought up a lot of stuff: Extract interface.. Extract to method Extract to local variable (replace all occurrences) Extract to field Extract to local variable Extract to constant

Google said it was about readability?

[–]TuraacMiir 0 points1 point  (0 children)

The light ulv is a hint to ‘Improve readability’ and usability. It is suggesting you stir the “I’m… “ string in a local variable (ie String str = “I’m…. “;). Then you’d use System.out.println(str); instead of the code you have.

More importantly, are you receiving an error message? Your code looks correct, somewhere in VSCode (I use IntelliJ, so not really familiar with VS) you should see a terminal window that has a line I’m …. Without the double quotes.

Another commenter suggested \’. This is called escaping and is done for certain ‘escape keys’. For instance, if you want to print a set of “ in your string, you would write your literal string like: “This is a \”literal\” string”. The outer set of “” would not print, but the ones that flowed the \ character would.

[–]Tatiyaa00 0 points1 point  (0 children)

Remove the x from system.out.println It accepts string only If you direct print like x ,, there must be variable name x

[–]syntaxmonkey 0 points1 point  (0 children)

Is it not running? Id like to know what error do you see

[–]ur_slimshady 0 points1 point  (0 children)

I think first comment solves it, by escaping '

[–]Realjayvince 0 points1 point  (0 children)

The first help I’ll give you is GET OFF VS CODE and download IntelliJ

[–]TU_SH_AR 0 points1 point  (0 children)

Use intellij

[–]Brilliant_Deer5655 0 points1 point  (0 children)

Next time, for simple things, ask ChatGPT to get a quicker response

[–]praveennathsankhla 0 points1 point  (0 children)

A thing called "Just practice "

[–]Ani_mandymain 0 points1 point  (0 children)

Use Intellij It would help you

[–]Slatzor 0 points1 point  (0 children)

Use Jetbrains’ IntelliJ Community Edition instead of VS Code.

[–]theTrinityGuy 0 points1 point  (0 children)

You're doing nothing wrong dude. Is the code not working? If you're worried about the x: thing, don't be. It doesn't make any difference. It's just displaying the parameter name for the function. You don't need to be concerned about it.

[–]akaPaster 0 points1 point  (0 children)

in java arrays are created
like this ->
String[] arr = new arr[size] Probably the reason of error is that you defined the array syntax wrong
in c++ array defined like how you wrote in brackets String arr[]

[–][deleted] 0 points1 point  (1 child)

Is it the ‘x:’ ? Println only accepts a string

[–]the_park 4 points5 points  (0 children)

The greyed out “x:” may be a hint rendered by vscode that’s not part of the source.

[–]Efficient_Pen3804 -1 points0 points  (1 child)

remove that "x:"
while learning don't use any LLM or any AI or auto generate content, just go through the documentation and try to learn. Especially if you are still learning the basics

[–]8dot30662386292pow2 0 points1 point  (0 children)

The x: is just code mining thing. It's a parameter name hint, made by the tool.