不,Java中没有这样的语法。
但是,其他一些语言也具有这种语法。示例包括Python的元组解包,以及许多功能语言中的模式匹配。例如,在Python中,您可以编写
string1, string2 = text.split(':', 2) # Use string1 and string2或在F#中,您可以编写
match text.Split([| ':' |], 2) with | [string1, string2] -> (* Some pre that uses string1 and string2 *) | _ -> (* Throw an exception or otherwise handle the case of text having no colon *)



