When Do You Use Continue And When Do You Use Break Statements

When continue statement is applied it prematurely completes the iteration of a loop. When break statement is applied it causes the entire loop to be abandoned. In Java, break and continue are control flow statements used within loops. Here’s a brief explanation of when to use each: break statement: The break statement is used to … Read more

What Are The Rules For Object Reference Casting

: Casting from Old types to Newtypes Compile time rules : – When both Oldtypes and Newtypes are classes, one should be subclass of the other – When both Oldtype ad Newtype are arrays, both arrays must contain reference types (not primitive), and it must be legal to cast an element of Oldtype to an … Read more

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