# Java_Week_1.txt

 The flashcards below were created by user andrewdb3 on FreezingBlue Flashcards. What is the use of Java Basic Operators? To manipulate variables. What are the arithmetic operators? AdditionSubtractionMultiplicationDivisionModulus %Increment ++Decrement- - What is the function of the addition AO? Adds values on either side of the operator. What is the function of the subtraction AO? Subtracts right-hand operand from the left-hand operand. What is an operator? Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. What is an operand? A value involved in an operation. What is an operation? An action performed on one or more values either to modify the value held by one or both of the values, or to produce a new value by combining existing values. What is the function of multiplication? Multiplies values on either side of the operator. What is the function of division? Divides left hand operand by right hand operand. What is the function of modulus? Divides left hand operand by right hand operand and returns remainder. What is the function of increment? Increases the value of operand by 1 What is the function of decrement? Decreases the value of operand by 1 How many AOs are there? 7 operators What are AOs used for? To manipulate variables How many Relational Operators are there? 6 operators What is the function of the Assignment RO? Checks if the values of two operands are equal or not, if yes then condition becomes true. What is the function of the Not Equal To RO? Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. What is the function of the Greater-Than RO? Checks if the value of left operand is greater than the value of right operand,if yes then condition becomes true. What is the function of the Less-Than RO? Checks if the value of le t operand is less than the value of right operand, if yes then condition becomes true. What is the function of the Greater-Than-Or_Equal_To RO? Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. What is the function of the RO? What is the function of the Less-Than-Or-Equal-To RO? Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. What is the function of a BO? Bitwise operator works on bits and performs bit-by-bit operation. What integer-types are BOs used with? LongIntShortCharByte What is the use of a BO? Research online How many Bitwise Operators are there? 7 Operators What are the BOs? Binary AND  (&)Binary OR  (|)Binary XOR    (∧)Binary One's Complement  (~)Binary Left Shift  (<<)Binary Right Shift  (>>)Shift Right Zero Fill (>>>) What is the Function of the BOs? Research later What are the Logical Operators? Logical AND (&&)Logical OR  (||)Logical NOT  (!) What is the function of the Logical AND LO? If both the operands are non-zero, then the condition becomes true. Example : (A && B)is false. What is the function of the Logical OR LO? If any of the two operands are non-zero, then the condition becomes true. Example : (A || B) is true. What is the function of the Logical NOT LO? Used to reverse the logical state of its operand. If a condition is true then Logical NOT operator will make false. Example : !(A && B)is true. How many Assignment Operators are there? 11 AOs What are the AOs? Simple  (=)Add AND  (+=)Subtract AND (-=)Multiply AND (*=)Divide AND (/=)Modulus AND  (%=)Left-shift AND (<<=)Right-shift AND  (>>=)Bitwise AND (&=)Bitwise exclusive OR  (∧=)Bitwise inclusive OR  (|=) What is the Function of the Simple AO? Assigns values from right side operands to left side operand. Example : C = A + B will assignvalue of A + B into C What is the function of the Add AND AO? It adds right operand to the left operand and assign the result to left operand. Examples : C += A is equivalent toC = C + A What is the function of the Subtract AND AO? It subtracts right operand from the left operand and assign the result to left operand. Example : C -= A is equivalent toC = C - A What is the function of the Multiply AND AO? It multiplies right operand with the left operand and assign the result to left operand. Example : C *= A is equivalent toC = C * A What is the function of the Divide AND AO? It divides left operand with the right operand and assign the result to left operand. Example : C /= A is equivalent toC = C / A What is the function of the Modulus AND AO? It takes modulus using two operands and assign the result to left operand. Example : C %= A is equivalentto C = C % A What is the function of the Left-shift AND AO? Example : C <<= 2 is same as C= C << 2 What is the function of the Right-shift AND AO? Example : C >>= 2 is same as C= C >> 2 What is the function of the Bitwise AND AO? Example : C &= 2 is same as C =C & 2 What is the function of the Bitwise-exclusive OR AO? Example : C ^= 2 is same as C =C ^ 2 What is the function of the Bit-wise inclusive OR AO? Example : C |= 2 is same as C =C | 2 How many Misc Operators are there? 2 Operators What are the Misc Operators? Conditional/Ternary OperatorInstanceOf Operator What is the structure of Conditional Operator? This operator consists of three operands.The operator is written as: variable x = (expression) ? value if true : value if false What is the function of the Conditional Operator? It is used to evaluate Boolean expressions.The goal of the operator is to decide which value should be assigned to the variable. An Example of the Conditional/Ternary Operator. public class Test {public static void main(String args[]){int a , b;a = 10;b = (a == 1) ? 20: 30;System.out.println( "Value of b is : " + b );b = (a == 10) ? 20:30;System.out.println( "Value of b is : " + b );  }}This would produce the following result: Value of b is : 30Value of b is : 20 What is the use of the instanceOf Operator? Used only for object reference variables. What is the function of the insatanceOf Operator? The operator checks whether the object is of a particular type(class type or interface type). What is the Structure of instanceOf Operator? ( Object reference variable ) instanceOf (class/interface type) Example1 of instanceOf Operator. If the object referred by the variable on the left side of the operator passes the IS-A check for the class/interface type on the right side, then the result will be true. Following is the example: String name = = 'James';boolean result = name instanceOf String;// This will return true since name is type of String Example2 of instanceOf Operator. This operator will still return true if the object being compared is the assignment compatible with the type on the right. Following is one more example: class Vehicle {}public class Car extends Vehicle {  public static void main(String args[]){    Vehicle a = new Car();    boolean result = a instanceof Car;    System.out.println( result);   }} This would produce the f ollowing result:true How many Categories are there for Java Operator Precedence? 15 Categories What are the categories of Java OP? PUMAS-REBBBLL-CAC PostfixUnaryMultiplicativeAdditiveShiftRelationalEqualityBitwise ANDBitwise XORBitwise ORLogical ANDLogical ORConditionalAssignmentComma What are the Postfix Operators? () [] .(dot operator)  Left to right association What are the Unary Operators? ++ - - ! ~ (Right to left) What are the Multiplicative Operators? * / % (Left to right) What are the Additive Operators? + - (Left to right) What are the Shift Operators? >> >>> <<  (Left to right) What are the Rational Operators? > >= < <=  (Left to right) What are the Equality Operators? == !=  (Left to right) What is the Bitwise AND Operator? & What is the Bitwise XOR Operator? ∧ What is the Bitwise OR Operator? | What is the Logical AND Operator? && What is the Logical OR Operator? || What is the Conditional Operator? ?: What is the Assignment Operators? = += -= *= /= %= >>= <<= &= ^= |= (Right to left) What is the Comma Operator? , Authorandrewdb3 ID265633 Card SetJava_Week_1.txt Descriptionjava 1 Updated2014-03-10T03:52:22Z Show Answers