What is the output of this program?
class Literal13
{
public static void main(String[] args)
{
boolean b="true";
System.out.println(b);
}
}
/*
Output:- CE[incompatible types]
Explanation:- The only allowed value for boolean data type are "true" and "false" and it must
be in lower case letter. If we are trying to assign except these two values then
it will rise an error of incompatible types.
*/
{
public static void main(String[] args)
{
boolean b="true";
System.out.println(b);
}
}
/*
Output:- CE[incompatible types]
Explanation:- The only allowed value for boolean data type are "true" and "false" and it must
be in lower case letter. If we are trying to assign except these two values then
it will rise an error of incompatible types.
*/
0 comments: