“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
the 2nd declaration will generate an error because of the word int inside the parenthesis. The 1st is correct because it cast the value to int that is the data type of the variable temp
First statement will be compiled without any error
because (int) is type cast function that convert
its value into integer.
float b=4.3;
ex:- int a=(int)b;
then a=4;
2nd stmt. will generate a error
the first declaration can be taken as type casting where the valuu (0*00) is converted to integer.
the second statement is an error because (0*00int)
makes no sense
the 2nd declaration will generate an error because of the word int inside the parenthesis. The 1st is correct because it cast the value to int that is the data type of the variable temp
The second statement is syntactically incorrect. First one statement is a valid declaration, however putting an (int) does not make any difference.
first will probably make int=0
the second I believe wont compile
the former implies multiplication of 0 with 00 and then type-casting is done to int data type for temp variable.
the later implies multiplication of 0 with a value as 00int.
first int(0*00) type casting
Here the first decleration
int temp =(int) (0×00);
is valid. The value stored in temp will be 0.
The second declearation
int temp = (0×00int);
will return compile-time error “) expected
In “0×00″ “x” is not multiplying operator. This is used to denoted hexadecimal.
The first one will compile right. But the second one is syntactically incorrect.
First statement will be compiled without any error
because (int) is type cast function that convert
its value into integer.
float b=4.3;
ex:- int a=(int)b;
then a=4;
2nd stmt. will generate a error
the first declaration can be taken as type casting where the valuu (0*00) is converted to integer.
the second statement is an error because (0*00int)
makes no sense
first one is correct.but 2nd one their are two error first temp is redeclaired and second invalid suffix of int.
second statement has error
we can’t give data type inside the parenthesis like this
compiler give an erro
Leave an Answer/Comment