Why does IntelliJ IDEA issue the expression "Expression expression is not an assignment or invocation error" for System.out.println?

Here is the code:

public class TryStuffOutHere { public static void main(String[] args) { System.out.println("Set the customer name: "); } } 

When I type this, IntelliJ IDEA stops highlighting the line "Set client name:" in all one color, as is done for other string literals, and places a red square line between words and mappings. "The expression of an expression is not an assignment or challenge." But if I changed the line to:

 System.out.print("Set the customer name: "); 

The line again looks like a normal line assignment (all one color, no control).

Even declaring a single line and issuing a variable still causes a problem.

I have added three images illustrating what I'm talking about. Does anyone have any idea what is going on? Apparently, I have not yet been allowed to post images. If you need / need screenshots, let me know. I would be happy to send them to you.

UPDATE (April 28, 2013): Well, now I have enough points to add screenshots. So here they are:

Image 1
enter image description here

Image 2
enter image description here

Image 3
enter image description here

Image 4
enter image description here

I also found that the 10-12 second delay after canceling the caches and restarting the IDE is due to the fact that the IDE is still "updating indexes". After that, the problem immediately appears ... sometimes. A further complication of this is that the cache invalidation and reloading worked twice until I left and opened the IDE again, after which it reappears.

+8
java string intellij-idea
source share
2 answers

It looks like he is trying to interpret the code as some other language than java.

Do you have additional plugins? Try disabling as much as possible to make sure none of them interfere.

+9
source share

I would try to delete the caches and restart. It sounds like a damaged state in IntelliJ, I also have to make sure that you have the latest version 12.1

+8
source share

All Articles