Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Nashorn

Deck JAVA 8 ( Nashorn )

TermDefinition
Acessando classes Java jjs> Packages.MyPackage [JavaPackage MyPackage] jjs> Packages.MyPackage.MyClass [JavaClass MyPackage.MyClass]
Criando objetos Java jjs> var HashMap = Java.type("java.util.HashMap") jjs> var mapDef = new HashMap() jjs> var map100 = new HashMap(100)
Usando Java Beans jjs> var Date = Java.type("java.util.Date") jjs> var date = new Date() jjs> date.year + 1900 2013 jjs> date.year = 2014 - 1900 114 jjs> date.year + 1900 2014
Criando um mecanismo de scrip Nashorn ScriptEngine engine = factory.getEngineByName("nashorn");
Trabalhando com números Java jjs> var intNum = 10 jjs> intNum.class class java.lang.Integer jjs> var dblNum = Number(intNum) jjs> dblNum.class class java.lang.Double
Extensão de classe em Java var Run = Java.type("java.lang.Runnable"); var MyRun = Java.extend(Run, { run: function() { print("Run in separate thread"); } }); var Thread = Java.type("java.lang.Thread"); var th = new Thread(new MyRun());
Habilitar extensões de script em shell(UNIX) jjs -scripting
Here Document $ jjs -scripting heredocs.js So... foo = bar and the current time is Thu Aug 01 2013 16:21:16 GMT+0200 (CEST) $
Shell invocations var lines = 'ls -lsa'.split("\n"); for each (var line in lines) { print("|> " + line); }
Nashorn interpreta as coleções Java como arrays jjs> var ArrayList = Java.type("java.util.ArrayList") jjs> var alist = new ArrayList() jjs> alist.add("a") true jjs> alist.add("b") true jjs> alist.add("c") true jjs> alist[1] b jjs> for each (var i in alist) print(i) a b c
Strings são interpretadas pelo Nashorn como objetos java.lang.String jjs> var a = "abc" jjs> a.class class java.lang.String jjs> var b = a + "def" jjs> b.class class jdk.nashorn.internal.runtime.ConsString jjs> var c = String(b) jjs> c.class class java.lang.String
Objetos Globais $ARG >> jjs -scripting -- arg1 arg2 arg3 jjs> $ARG arg1,arg2,arg3 jjs> $ARG[1] arg2
Objetos Globais $ENV jjs> $ENV.USER johndoe jjs> $ENV.PWD /foo/bar
Objetos Globais $EXEC() jjs> $EXEC("ls -l") total 0 drwxr-xr-x+ 1 johndoe staff 4096 Aug 18 11:03 dir -rwxrw-r-- 1 johndoe staff 168 Aug 19 17:44 file.txt jjs>
load()Essa função carrega e avalia um script de um caminho, URL, ou um objeto. jjs> load("/foo/bar/script.js") jjs> load("http://example.com/script.js")
A função Java.type pode ser usada para se obter referências precisas do tipo Java var LinkedList = Java.type( "java.util.LinkedList"); var primitiveInt = Java.type( "int"); var arrayOfInts = Java.type( "int[]");
Interpretar uma aplicação de script JavaFX com o Nashorn, usando o mando jjs com a opção -fx jjs -fx JavaFXscript.js
Funções function sqr(x) x * x; print(sqr(3));
Created by: marcelotmr
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards