nudge4j

Examples

The best snippets are probably going to be the ones you are going to write. Because they can be specific to your application and access packages and classes that only you know of.

Yet, here is some sample code that shows how we get inside the JVM, to get you started.

//
// You can call any static method.
// java.time.LocalDate is the fully qualified class 
// and now() is the static method.
//
java.time.LocalDate.now();
//
// writing on the logs.
// 
java.lang.System.out.println('Hello world');
java.lang.System.err.println('and Hello world (again)');
'check your JVM logs'
//
// Building a Java Object is easy 
//
var list = new java.util.ArrayList();
list.add('apple');
list.add('banana');
list.add('cherry');
list;
// did you know that Integer had a static 'toBinaryString' method ?
var str='';
for (var i=0;i<16;i++) {
    str+=i+' '+java.lang.Integer.toBinaryString(i)+'\n'
}
str;