Find the output for the following program:
==================================
package blog;
public class IfElseDemo {
public static void main(String[] args) {
int a=10,b=20;
if (a=b)
{
System.out.println("a is bigger");
System.out.println("value of a is : " +a);
System.out.println("value of b is : " +b);
}
else
{
System.out.println("b is smaller");
}
}
}
==================================
package blog;
public class IfElseDemo {
public static void main(String[] args) {
int a=10,b=20;
if (a=b)
{
System.out.println("a is bigger");
System.out.println("value of a is : " +a);
System.out.println("value of b is : " +b);
}
else
{
System.out.println("b is smaller");
}
}
}
1. Compile Time Error
2. Null PointerException
3. NoSuchElementException
4. None of the above
ANSWER : Compile time error.
No comments:
Post a Comment