36A I Do Declare Write a half page comparing explicit and im

3-6-A I Do Declare

Write a half page comparing explicit and implicit declaration of data variables and data types. Compare advantages and disadvantages of each approach.

Solution

eg2. Explicit conversion of data type : var x = (int) a;

We are telling the compiler to convert variable a into x,

Implicit Declaration Explicit Declaration
It is done by the compiler. It is done by the user/programmer.
eg1. Default constructor is declared implicitly for every class not having any constructor defined by the user. eg1. We explicitly declare a parameterised constructor in java.
eg2. Implicit conversion of data type : int a = 7;
Implicit conversion done automatically by the compiler : float x=a;

eg2. Explicit conversion of data type : var x = (int) a;

We are telling the compiler to convert variable a into x,

Advantage: Easier Naming convention. Binding of variable to a type based on variable name is done by the compiler. Advantage: Dynamic binding of variable provides more programming flexibility.
Disadvantage : They prevent compiler to detect any typographical or programmer error. Disadvantage : It allows any variable to be assigned value of any type.
3-6-A I Do Declare Write a half page comparing explicit and implicit declaration of data variables and data types. Compare advantages and disadvantages of each

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site