Java MCQ - English
What is the output of this program?
class Output
{
Home | Discussion Forum
{
What is the output of this program?
class Output
{
public static void main(String args[])
{
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
b++;
++a;
System.out.println(a + " " + b + " " + c);
}
}
Answer : D
View More Related Question
1) What is the output of this program?
class increment
{
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
2) What will be the output?
if(1 + 1 + 1 + 1 + 1 == 5)
{
System.out.print("TRUE");
}
else
{
System.out.print("FLASE");
}
3) What is the output of this program?
class increment
{
public static void main(String args[])
{
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " + var4);
}
}
4) What is the output of this program?
class array_output
{
public static void main(String args[])
{
char array_variable [] = new char[10];
for (int i = 0; i < 10; ++i)
{
array_variable[i] = 'i';
System.out.print(array_variable[i] + "" );
i++;
}
}
}
5) What is the output of this program?
class increment
{
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}