-2

how can I use a log() on Java, the way we use console.log() in javascript?

It gives me a syntax error

Please and thank you, best regards

Sarvesh Mahajan
  • 914
  • 7
  • 16

4 Answers4

2

You can use System.out.print("Hello word") in order to print on your console.

If you want to learn more https://www.javatpoint.com/system-out-println-in-java

2

Java doesn't use console.log; it is a totally different language than Javascript. You would use System.out.print or System.out.println instead.

Good luck with your learning!

Josh Mathews
  • 198
  • 1
  • 15
0

You may need to take a tutorial anyway:

System.out.println(String msg)
Renaldo Balaj
  • 2,390
  • 11
  • 23
0

System.out.println("message"); will write a message to the console.

Matt U
  • 4,970
  • 9
  • 28