标记“:”的语法错误,eclipse 中的无效 AssignmentOperator ide

Syntax error on token ":", invalid AssignmentOperator in eclipse ide

我只是想学习如何使用接口和 Lambda 表达式。我不认为我做错了什么,但我遇到了语法错误。

package Main;

public class Main {
    
    public static void main(String[] args) {
        
        InfacePrintToConsole console = (String text) -> {};     
        console.defPrint(text:"main"); // Error here        
    }
}
package Main;

import java.io.OutputStream;

public interface InfacePrintToConsole {
    
    void print(String text);
    
    default public void defPrint(String text) {
        System.out.print(text);
    };
    
    static void println(String text) {
        System.out.println(text);
    }   
}

文本:变灰,不是真正的文本输入,而是 Intellij 功能 Viewing Method Parameter Information

have the list of parameter types for the called method or function shown automatically after a certain delay

它可以帮助您找到您正在输入的参数名称,将其从实际代码中删除

console.defPrint("main");