What Are The Rules For Object Reference Assignment And Method Call Conversion

An interface type can only be converted to an interface type or to object. If the new type is an interface, it must be a superinterface of the old type. A class type can be converted to a class type or to an interface type. If converting to a class type the new type should … Read more

What Are The Rules For Casting Primitive Types

: You can cast any non Boolean type to any other non boolean type. You cannot cast a boolean to any other type; you cannot cast any other type to a boolean. In Core Java, casting primitive types involves converting one primitive data type to another. There are two types of casting: widening (implicit) and … Read more

For Binary Operands :

If one of the operands is double, the other operand is converted to double Else If one of the operands is float, the other operand is converted to float Else If one of the operands is long, the other operand is converted to long Else both the operands are converted to int. It seems like … Read more

What Are The Rules For Primitive Arithmetic Promotion Conversion

: For Unary operators If operant is byte, short or a char it is converted to an int. If it is any other type it is not converted. In Java, primitive arithmetic promotion conversion follows a set of rules to determine the type of the result when performing operations on primitive data types. The rules … Read more

What Are Volatile Variables

It indicates that these variables can be modified asynchronously. In Java, the volatile keyword is used to indicate that a variable’s value may be changed by multiple threads simultaneously. It ensures that any thread that reads the variable sees the most recent modification made by any other thread. When a variable is declared as volatile, … Read more