What is the output of this program?
class mainclass
{

Home | Discussion Forum

What is the output of this program?

class mainclass
{
public static void main(String args[])
{
boolean var1 = true;
boolean var2 = false;
if (var1)
System.out.println(var1);
else
System.out.println(var2);
}
}

View More Related Question

1) What is the output of this program?

class average
{
public static void main(String args[])
{
double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};
double result;
result = 0;
for (int i = 0; i < 6; ++i)
result = result + num[i];
System.out.print(result/6);
}
}

2) 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);
}
}

3) Determine output:

public class Test{
int i = 34;
public static void main(String args[])
{
Test t1 = new Test();
Test t2 = new Test();
t1.i = 65;
System.out.print(t1.i);
System.out.print(t2.i);
}
}

4) What will be the output?

if(1 + 1 + 1 + 1 + 1 == 5)
{
System.out.print("TRUE");
}
else
{
System.out.print("FLASE");
}

5) What is the output of this program?

class variable_scope
{
public static void main(String args[])
{
int x;
x = 5;
{
int y = 6;
System.out.print(x + " " + y);
}
System.out.println(x + " " + y);
}
}

UP Gk Online Test

taiyari24hour.com