亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? operators and assignments(1).txt

?? 我自自己在學習過程找到的一些jsp代碼
?? TXT
字號:
作者:jeru
email: jeru@163.net
日期:7/3/2001 9:55:32 AM
5)Operators and Assignments
Objective 1)
Determine the result of applying any operator including assignment operators and instanceof to operands of any type class scope or accessibility or any combination of these.
1.    Unary operators.
1.1    Increment and Decrement operators ++ --
We have postfix and prefix notation. In post-fix notation value of the variable/expression is modified after the value is taken for the execution of statement. In prefix notation, value of the variable/expression is modified before the value is taken for the execution of statement.

x = 5; y = 0; y = x++;  Result will be x = 6, y = 5
x = 5; y = 0; y = ++x;  Result will be x = 6, y = 6

Implicit narrowing conversion is done, when applied to byte, short or char.

1.2    Unary minus and unary plus + -
+ has no effect than to stress positivity.
- negates an expression’s value. (2’s complement for integral expressions)
1.3    Negation !
Inverts the value of a boolean expression.
1.4    Complement ~
Inverts the bit pattern of an integral expression. (1’s complement – 0s to 1s and 1s to 0s)
(~i=-i-1)
Cannot be applied to non-integral types.
1.5    Cast ()
Persuades compiler to allow certain assignments. Extensive checking is done at compile and runtime to ensure type-safety.

2.    Arithmetic operators - *, /, %, +, - 
·    Can be applied to all numeric types. 
·    Can be applied to only the numeric types, except ‘+’ – it can be applied to Strings as well.
·    All arithmetic operations are done at least with ‘int’. (If types are smaller, promotion happens. Result will be of a type at least as wide as the wide type of operands)
·    Accuracy is lost silently when arithmetic overflow/error occurs. Result is a nonsense value.
·    Integer division or % by zero throws ArithmeticException.
·    Floating point arithmetic always loses precision. The following code fragment returns false.
float f = 1.0 F / 3.0 F; 
if ( A * 3.0 F == 1.0 F ) return true; 
else return false;
·    % - sign of the result entirely determined by sign of LHS
·    Floating point calculations can produce NaN (square root of a negative no. or % by zero) or Infinity/-Infinity( division by zero). Float and Double wrapper classes have named constants for NaN and infinities.
·    NaN’s are non-ordinal for comparisons. X ==  Float.NaN won’t work. Use Float.IsNaN(x) and Double.IsNaN(x). But equals method on wrapper objects(Double or Float) with NaN values compares Nan’s correctly.
·    Infinities are ordinal. X == Double.POSITIVE_INFINITY will give expected result.
·    + also performs String concatenation (when any operand in an expression is a String). The language itself overloads this operator. toString() method of non-String object operands are called to perform concatenation. In case of primitives, a wrapper object is created with the primitive value and toString method of that object is called. (“Vel” + 3 will work.)
·    Be aware of associativity when multiple operands are involved.
System.out.println( 1 + 2 + “3” ); // Prints 33
System.out.println( “1” + 2 + 3 ); // Prints 123

3.    Shift operators - <<, >>, >>>
·    << performs a signed left shift. 0 bits are brought in from the right. Sign bit (MSB) is preserved.(?) Value becomes old value * 2 ^ x where x is no of bits shifted.
·    >> performs a signed right shift. Sign bit is brought in from the left. (0 if positive, 1 if negative. Value becomes old value / 2 ^ x where x is no of bits shifted. Also called arithmetic right shift.
·    >>> performs an unsigned logical right shift. 0 bits are brought in from the left. This operator exists since Java doesn’t provide an unsigned data type (except char). >>> changes the sign of a negative number to be positive. So don’t use it with negative numbers, if you want to preserve the sign. Also don’t use it with types smaller than int. (Since types smaller than int are promoted to an int before any shift operation and the result is cast down again, so the end result is unpredictable.)
·    Shift operators can be applied to only integral types.
·    -1 >> 1 is –1, not 0. 
·    1 << 31 will become the minimum value that an int can represent. 
·    Negative numbers are represented in two’s complement notation. (Take one’s complement and add 1 to get two’s complement)
·    Shift operators never shift more than the number of bits the type of result can have. ( i.e. int 32, long 64) RHS operand is reduced to RHS % x where x is no of bits in type of result.  
int x; 
x == x >> 32 // ture
x =  x >> 33;  // Here actually what happens is x >> 1
·    if right side is negative, for int, use low 5 bits; for long, use low 6 bits.

4.    Comparison operators – all return boolean type.
4.1    Ordinal comparisons - <, <=, > , >= 
·    Only operate on numeric types. Test the relative value of the numeric operands.
·    Arithmetic promotions apply. char can be compared to float.
4.2    Object type comparison – instanceof
·    Tests the class of an object at runtime. Checking is done at compile and runtime same as the cast operator.
·    Returns true if the object denoted by LHS reference can be cast to RHS type.
·    LHS should be an object reference expression, variable or an array reference.
·    RHS should be a class (abstract classes are fine), an interface or an array type, castable to LHS object reference. Compiler error if LHS & RHS are unrelated.
·    Can’t use java.lang.Class or its String name as RHS.(?)
·    Returns true if LHS is a class or subclass of RHS class
·    Returns true if LHS implements RHS interface.
·    Returns true if LHS is an array reference and of type RHS.
·    x instanceof Component[] – legal.
·    x instanceof [] – illegal. Can’t test for ‘any array of any type’
·    Returns false if LHS is null, no exceptions are thrown.
·    If x instanceof Y is not allowed by compiler, then Y y = (Y) x is not a valid cast expression. If x instanceof Y is allowed and returns false, the above cast is valid but throws a ClassCastException at runtime. If x instanceof Y returns true, the above cast is valid and runs fine.
4.3    Equality comparisons - ==, !=
·    For primitives it’s a straightforward value comparison. (promotions apply)
·    For object references, this doesn’t make much sense. Use equals method for meaningful comparisons. (Make sure that the class implements equals in a meaningful way, like for X.equals(Y) to be true, Y instance of X must be true as well)
·    For String literals, == will return true, this is because of compiler optimization.
5.    Bit-wise operators - &, ^, |
·    Operate on numeric and boolean operands.
·    & - AND operator, both bits must be 1 to produce 1.
·    | - OR operator, any one bit can be 1 to produce 1.
·    ^ - XOR operator, any one bit can be 1, but not both, to produce 1.
·    In case of booleans true is 1, false is 0.
·    Order:  AND, XOR, OR.
·    Can’t cast any other type to boolean.

6.    Short-circuit logical operators - &&, ||
·    Operate only on boolean types.
·    RHS might not be evaluated (hence the name short-circuit), if the result can be determined only by looking at LHS.
·    false && X  is always false.
·    true || X is always true.
·    RHS is evaluated only if the result is not certain from the LHS.

7.    Ternary operator
·    Format a = x ? b : c ;
·    x should be a boolean expression.
·    Based on x, either b or c is evaluated. Both are never evaluated.
·    b will be assigned to a if x is true, else c is assigned to a.
·    b and c should be assignment compatible to a. 
·    b and c are made identical during the operation according to promotions. 

8.    Assignment operators.
·    Simple assignment =.
·    op= calculate and assign operators(extended assignment operators)
·    *=, /=, %=, +=, -=
·    x += y means x = x + y. But x is evaluated only once. Be aware.
·    Assignment of reference variables copies the reference value, not the object body.
·    Assignment has value, value of LHS after assignment. So a = b = c = 0 is legal. c = 0 is executed first, and the value of the assignment (0) assigned to b, then the value of that assignment (again 0) is assigned to a. 
·    Extended assignment operators do an implicit cast. (Useful when applied to byte, short or char)
byte b = 10;
b = b + 10; // Won’t compile, explicit cast reqd since the expression evaluates to an int
b += 10; // OK, += does an implicit cast from int to byte

9.    General
·    In Java, No overflow or underflow of integers happens. i.e. The values wrap around. Adding 1 to the maximum int value results in the minimum value. 
·    Always keep in mind that operands are evaluated from left to right, and the operations are executed in the order of precedence and associativity.  
·    Unary Postfix operators and all binary operators (except assignment operators) have left to right assoiciativity.
·    All unary operators (except postfix operators), assignment operators, ternary operator, object creation and cast operators have right to left assoiciativity.
·    Inspect the following code.
public class Precedence {
  final public static void main(String args[]) {
    int i = 0; 
    i = i++; 
    i = i++; 
    i = i++;
    System.out.println(i); // prints 0, since = operator has the lowest precedence.
    
    int array[] = new int[5];
    int index = 0;
array[index] = index = 3; // 1st element get assigned to 3, not the 4th element

    for (int c = 0; c < array.length; c++)
      System.out.println(array[c]);    
    System.out.println("index is " + index); // prints 3    
  }
}

Type of Operators    Operators    Associativity
Postfix operators    [] . (parameters) ++ --    Left to Right
Prefix Unary operators    ++  -- + - ~ !    Right to Left
Object creation and cast    new (type)    Right to Left
Multiplication/Division/Modulus    * / %    Left to Right
Addition/Subtraction    + -    Left to Right
Shift    >> >>> <<    Left to Right
Relational    < <= > >= instanceof    Left to Right
Equality    == !=    Left to Right
Bit-wise/Boolean AND    &    Left to Right
Bit-wise/Boolean XOR    ^    Left to Right
Bit-wise/Boolean OR    |    Left to Right
Logical AND (Short-circuit or Conditional)    &&    Left to Right
Logical OR (Short-circuit or Conditional)    ||    Left to Right
Ternary    ? :    Right to Left
Assignment    = += -= *= /= %= <<= >>= >>>= &= ^= |=    Right to Left




?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久狠狠亚洲综合| 亚洲乱码日产精品bd| 国产999精品久久久久久绿帽| 成人免费在线视频观看| 日韩午夜小视频| 在线日韩一区二区| 成人激情午夜影院| 麻豆精品蜜桃视频网站| 亚洲激情六月丁香| 中文字幕免费不卡在线| 久久一日本道色综合| 7777精品伊人久久久大香线蕉最新版 | 国产69精品久久99不卡| 免费在线看一区| 亚洲女人****多毛耸耸8| 国产精品丝袜91| 国产区在线观看成人精品| 欧美成人bangbros| 91精品国产福利在线观看| 欧洲人成人精品| 色婷婷av一区二区三区软件| 丁香一区二区三区| 国产一区二区三区日韩| 麻豆久久久久久| 免费视频最近日韩| 美女视频一区在线观看| 日韩中文字幕区一区有砖一区| 一区二区三区免费| 亚洲免费高清视频在线| 亚洲女与黑人做爰| 亚洲少妇中出一区| 亚洲精品乱码久久久久久黑人 | 亚洲激情成人在线| 亚洲精品日韩专区silk| 亚洲欧美另类小说| 尤物在线观看一区| 洋洋av久久久久久久一区| 亚洲色图色小说| 亚洲中国最大av网站| 亚洲一区二区三区在线播放| 亚洲成人激情综合网| 亚洲电影欧美电影有声小说| 亚洲成人免费视频| 日本不卡视频在线观看| 麻豆高清免费国产一区| 国产在线不卡视频| 成人永久aaa| 91女人视频在线观看| 在线中文字幕一区二区| 欧美欧美午夜aⅴ在线观看| 在线播放欧美女士性生活| 日韩丝袜美女视频| 久久众筹精品私拍模特| 国产精品久久精品日日| 一区二区三区中文字幕在线观看| 亚洲国产成人tv| 免费成人在线播放| 丁香六月综合激情| 一道本成人在线| 69堂精品视频| 国产午夜精品一区二区三区嫩草 | 激情综合网激情| 国产iv一区二区三区| 一本一道久久a久久精品| 69久久99精品久久久久婷婷| 精品国产一区二区精华| 亚洲视频1区2区| 日本欧美在线观看| 国产不卡视频在线播放| 欧美午夜不卡在线观看免费| 精品日韩99亚洲| 中文字幕一区二区三区不卡在线 | 成人av资源在线观看| 91久久精品国产91性色tv| 欧美一级日韩不卡播放免费| 中文字幕av资源一区| 亚洲国产sm捆绑调教视频 | 国产v综合v亚洲欧| 欧美色图一区二区三区| 久久综合给合久久狠狠狠97色69| 亚洲美女屁股眼交| 国产在线播放一区二区三区| 色狠狠色狠狠综合| 久久综合九色综合久久久精品综合| 亚洲免费在线播放| 国产一区二区三区在线看麻豆| 91麻豆国产自产在线观看| 欧美成人一区二区三区片免费| 中文字幕日韩精品一区| 久久国产精品无码网站| 日本精品免费观看高清观看| 久久精品夜夜夜夜久久| 日韩精品每日更新| 91影院在线免费观看| 欧美精品一区二区精品网| 亚洲大片精品永久免费| 成人app在线| 欧美精品一区二区久久婷婷| 亚洲不卡在线观看| 91原创在线视频| 中文字幕国产一区二区| 麻豆视频观看网址久久| 欧美日韩视频在线观看一区二区三区| 国产欧美日产一区| 极品尤物av久久免费看| 欧美一级电影网站| 亚洲成人福利片| 色偷偷久久一区二区三区| 日本一区二区高清| 国产在线麻豆精品观看| 欧美一级高清大全免费观看| 亚洲成人资源网| 欧洲视频一区二区| 一区二区三区四区高清精品免费观看 | 亚洲成va人在线观看| 99v久久综合狠狠综合久久| 久久精品欧美一区二区三区不卡| 免费观看在线色综合| 欧美日韩国产在线播放网站| 亚洲免费伊人电影| 一本到三区不卡视频| 国产精品久久久久婷婷二区次| 国产一区视频在线看| 精品精品国产高清a毛片牛牛| 天天操天天色综合| 欧美福利一区二区| 日本一不卡视频| 7777精品伊人久久久大香线蕉经典版下载| 一区二区免费在线播放| 91免费小视频| 洋洋av久久久久久久一区| 欧美无人高清视频在线观看| 亚洲午夜免费福利视频| 欧美性淫爽ww久久久久无| 亚洲一区二区美女| 欧美高清视频www夜色资源网| 天堂蜜桃91精品| 日韩精品一区二| 韩国毛片一区二区三区| 国产婷婷精品av在线| 成人黄色av电影| 亚洲欧美另类久久久精品2019| 在线精品视频免费观看| 香蕉久久一区二区不卡无毒影院 | 日韩精品一区二区三区在线| 久久99精品一区二区三区 | 日韩国产高清在线| 日韩一级免费一区| 美美哒免费高清在线观看视频一区二区 | 久久久久成人黄色影片| 丁香五精品蜜臀久久久久99网站| 国产精品久久久久aaaa| 欧美色图在线观看| 九色porny丨国产精品| 国产女主播视频一区二区| 91亚洲国产成人精品一区二三| 亚洲一二三专区| 欧美大片一区二区| 成人综合在线视频| 亚洲一区二区精品视频| 亚洲精品一区在线观看| 99在线热播精品免费| 亚洲成av人片一区二区| 久久久久国产精品厨房| 在线免费不卡视频| 九九九精品视频| 中文字幕一区二区在线播放| 337p亚洲精品色噜噜| 国产白丝网站精品污在线入口| 亚洲精品五月天| 久久婷婷久久一区二区三区| 97se亚洲国产综合自在线观| 午夜不卡av免费| 国产欧美一区二区精品秋霞影院| 在线影院国内精品| 国产乱子轮精品视频| 亚洲一区在线视频| 久久午夜电影网| 欧美日本一道本| 成人性色生活片| 蜜臀av一区二区在线观看| 日韩美女视频一区| 精品国产乱码久久久久久影片| 色婷婷精品久久二区二区蜜臀av| 一区二区高清视频在线观看| 国产在线一区观看| 一区二区三区av电影 | 精品国产一二三区| 色老汉一区二区三区| 国产在线播放一区三区四| 亚洲国产精品综合小说图片区| 久久久高清一区二区三区| 欧美日韩夫妻久久| 99久久综合狠狠综合久久| 久久99国内精品| 亚洲国产综合在线| 亚洲欧美一区二区在线观看| 久久中文娱乐网| 精品少妇一区二区三区| 欧美精品国产精品|