Predict the output of the following Java code.
Which of these code segments will give an error for declaration of a char variable in Java?
What is the type of variable ‘b’ and ‘d’ in the following Java snippet?
int a[], b;
int []c, d;
Which two cause a compiler error?
public class outputs
{
public static void main(String args[])
{
int a = 3;
int b = 12;
System.out.print(++a%10 * 8%2 + ++a%b);
}
}
public class output{
public static void main(String args[]){
char num [] = new char[10];
for (int i = 0; i < 10; ++i){
num[i] = 'S';
System.out.print(num[i] + "");
}
}
}
What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
Double x = Double.MIN_VALUE;
System.out.print(x);
}
}
class A
{
public static void main(String args[])
{
int a= 15;
int b= 20;
if ((b = 1) == a)
System.out.print(b);
else
System.out.print(++b);
}
}
Is it possible to use a default constructor even if an explicit constructor is defined?
class show
{
public static void main(String args[])
{
try
{
throw new NullPointerException ("Hello");
System.out.println("Abekus");
}
catch(ArithmeticException e)
{
System.out.println("Slack");
}
}
}