For some unknown reason, when writing System.out.println, neither the IDE nor the console compilation will recognize the println command, just like just print. It happened suddenly, just a week ago, everything was OK. I read a book on Java and do not quite understand what the problem is.

public class TestClass { System.out.println("Something"); } 
  • What error gives out? import system in place? - rjhdby
  • Cannot resolve symbol 'println'. So System is included in the pack java.lang. Why import it? The program is dropped on println. - Arc
  • You can show the full code of the entire file what is written there - Alexey Shimansky
  • one
    And add to the question a piece with your imports - rjhdby
  • Added code. There are no imports, just a test class with one team. I tried in the console and in IntelliJ IDEA. Neither there nor there does not work. - Arc

1 answer 1

I on the place of the compiler also swore. Gave a class, without methods, and inside the code. Your class should look at least that way.

 class TestClass { public static void main (String[] args) { System.out.println("Something"); } } 
  • Thank you. I haven’t been coding for two weeks already and have completely forgotten about the announcement of the main function - Arc