1
(a) What is meant by precedence of operators?
Show SolutionHide Solution↓
Precedence of operators refers to the order in which the operators are applied to the operands in an expression.
(b) What is a literal?
Literals are data items that are fixed data values. Java provides different types of literals like:
- Integer Literals
- Floating-Point Literals
- Boolean Literals
- Character Literals
- String Literals
- null Literal
(c) State the Java concept that is implemented through:
- a superclass and a subclass.
- the act of representing essential features without including background details.
- Inheritance
- Abstraction
(d) Give a difference between a constructor and a method.
Constructor has the same name as class name whereas function should have a different name than class name.
(e) What are the types of casting shown by the following examples?
double x = 15.2;
int y = (int) x;int x = 12;
long y = x;
- Explicit Type Casting
- Implicit Type Casting