Predict the output of the following Java code.
What is the return type of a constructor?
Which method is used to prevent thread execution?
Which method of the FileReader class is used to read characters from a file?
How do you configure JUnit tests to use PowerMock?
The process of defining the methods in a class having same name & different type signature is called
What will be the output of the following Java code?
public class ex {
public static void main(String[] args) {
int x = 10, y = 20;
if (x > 15 || y > 10)
System.out.println(x);
else
System.out.println(y);
}
}
// Predict the output
public class Main{
public static void main(String args[])
{
int array[][] = { { 42, 2, 23},
{ 5, 60, 12},
{ 19, 10, 1},
};
function(array);
}
public static void function(int array[][])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
System.out.print(array[j][i] + " ");
}
System.out.println();
}
}
}
import java.util.*;
class output
{
public static void main(String args[])
{
LinkedList obj = new LinkedList();
obj.add("A");
obj.add("B");
obj.add("C");
obj.addLast(new Integer(25));
obj.removeFirst();
obj.removeLast();
obj.pollFirst();
obj.pollLast();
System.out.println(obj);
}
}
What will be the output of the following code?
class A
{
public int a;
private int b;
void cal(int x, int y)
{
a = x + 1;
b = y;
}
}
public class main
{
public static void main(String args[])
{
A a = new A();
obj.cal(1, 2);
System.out.println(a.a + " " + a.b);
}
}