Java FX ±àд½Å±¾
½Å±¾±äÁ¿ÊÇʹÓà var »ò def ¹Ø¼ü×ÖÉùÃ÷µÄ¡£
¶þÕßÖ®¼äµÄÇø±ðÔÚÓÚ£ºÔڽű¾µÄÕû¸öÉúÃüÖÜÆÚÄÚ¶¼¿ÉÒÔΪ var ±äÁ¿¸³ÓèÐÂÖµ£¬
¶ø def ±äÁ¿ÔÚ±»Ê״θ³ÓèÐÂÖµºó½«±£³Ö²»±ä£»
def numOne = 100;
def numTwo = 2;
var result;
add();
subtract();
multiply();
divide();
function add() {
result = numOne + numTwo;
println("{numOne} + {numTwo} = {result}");
}
function subtract() {
result = numOne - numTwo;
println("{numOne} - {numTwo} = {result}");
}
function multiply(){
result = numOne * numTwo;
println("{numOne} * {numTwo} = {result}");
}
function divide() {
result = numOne / numTwo;
println("{numOne} / {numTwo} = {result}");
}
ÎÒÃDz»ÐèÒª½«ÕâЩ±äÁ¿Ã÷È·Ö¸¶¨Îª´æ·ÅÊýÖµÐÍÊý¾Ý£¨¶ø²»ÊÇ×Ö·û´®»òÈκÎÆäËûÀàÐ͵ÄÊý¾Ý£©¡£±àÒëÆ÷·Ç³£ÖÇÄÜ£¬¿ÉÒÔ¸ù¾ÝʹÓñäÁ¿µÄÉÏÏÂÎÄÀ´ÅªÇåÄúµÄÒâͼ¡£Õâ³ÆΪÀàÐÍÍƶϡ£ÀàÐÍÍƶϿÉÒÔʹ½Å±¾³ÌÐòÔ±µÄ¹¤×÷ÓÐËù¼ò»¯£¬ÕâÊÇÓÉÓÚËüÊ¡È¥ÁËÉùÃ÷±äÁ¿ÓëÖ®¼æÈݵÄÊý¾ÝÀàÐ͵Ť×÷¡£
Ïà¹ØÎĵµ£º
µ±Á½¸ö½ø³ÌÔÚ½øÐÐÔ¶³ÌͨÐÅʱ£¬±Ë´Ë¿ÉÒÔ·¢Ë͸÷ÖÖÀàÐ͵ÄÊý¾Ý¡£ÎÞÂÛÊǺÎÖÖÀàÐ͵ÄÊý¾Ý£¬¶¼»áÒÔ¶þ½øÖÆÐòÁеÄÐÎʽÔÚÍøÂçÉÏ´«ËÍ¡£·¢ËÍ·½ÐèÒª°ÑÕâ¸öJava¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬²ÅÄÜÔÚÍøÂçÉÏ´«ËÍ£»½ÓÊÕ·½ÔòÐèÒª°Ñ×Ö½ÚÐòÁÐÔÙ»Ö¸´ÎªJava¶ÔÏó¡£
¡¡¡¡°ÑJava¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì³ÆΪ¶ÔÏóµÄÐòÁл¯¡£
¡¡¡¡°Ñ×Ö½ÚÐòÁлָ´ÎªJava¶ÔÏóµÄ¹ ......
eval.jar ÐèÒªµ½https://eval.dev.java.net/
ÏÂÔØ
--ÏÂÃæÊÇʾÀýʹÓã¬Ö§³ÖÖÐÎıäÁ¿
Expression exp = new
Expression("(x + y)/2"
);
Map<String, BigDecimal> variables = new
HashMap<String, BigDecimal>();
variables.put("x", new
BigDecimal("4.32"
)); ......
ʹÓÃjavaÖеĶ¯Ì¬´úÀí¿ÉÒÔÍê³ÉºÜ¶àÊÂÇ飬±ÈÈ罫ҵÎñʵÀý½øÐÐÍйܣ¬ÊµÏÖAOPµÈ£¬µ«ÊÇPhpÖÐûÓÐʵÏÖÕâÑùµÄ¶«Î÷£¬×òÌìͻȻÏëµ½Æäʵ¿ÉÒÔͨ¹ýevalÀ´Ä£ÄâÒ»¸ö¶¯Ì¬´úÀí»úÖÆ¡£php±Èjava²»Í¬µÄÊÇ£¬phpÊDz»ÐèÒª±àÒëµÄ£¬Òò´ËÖ»ÒªÎÒÃÇÄܹ»¶¯Ì¬Éú³ÉÒ»¶Î´úÂ룬ȻºóÓÃevalÀ´Ö´ÐоͿÉÒԴﵽЧ¹û¡£´úÂëÈçÏ£º
/**
* ´úÀíʵÏÖÀà
*/
inter ......
×òÌì¿´µ½ÕâÑùһƪÌû×Ó£¬ÌÖÂÛÀà¼ÓÔØ˳ÐòµÄ£¬Ò²¿ÉÒÔ˵Êdzõʼ»¯Ë³ÐòµÄ£¬½ñÌìÔçÉÏÕÒ²»µ½ÁË£¬±¾À´Ïë»Ø¸´µÄ£¬ÏÖÔÚ×Ô¼ºÐ´²©¿Í»Ø¸´ÁË£¬ºÇºÇ
public class Singleton {
private static Singleton obj = new Singleton();
public static int counter1 ;
public static int counter2 = 0;& ......