Дата публикации: 04.11.2013 14:02:10
The most powerful advantage of JavaFX is an easy use of Java classes. However, you can encounter an issue when calling some methods, for example, those that have the insert and delete names. The File class contains the delete method. How would you delete a file from JavaFX?
The issue here is that the insert and delete names are JavaFX keywords used for sequences. If you try to compile a code that uses the delete method, you will get the following error message.
Sorry, I was trying to understand an expression but I got confused when I saw 'delete' which is a keyword. new java.io.File("temp").delete(); ^
To solve this issue, use double angle brackets.
new java.io.File("temp").<<delete>>();
But that's the half of the story so far! This syntax allows any text line to be used as an identifier.
def <<english variable>> = "any symbols can be used as identifier"; def <<русская переменная>> = <<english variable>>; println(<<русская переменная>>);
Note that CR/LF is a part of the identifier above. You can use a funny mug as a name for a debugging function:
function << o.O >> (error) { println("ERROR: {error}") } << o.O >> ("WTF!");
The code above prints ERROR: WTF!
PS. This article was originally posted on the Java.net site.