What data type is returned by every method of OutputStream?
In Java, when we implement an interface method, it must be declared as:
Which public method is used to return the value of a private variable outside the class?
Which exception is thrown by the constructors of the URL class?
When the operators have same priority then they are executed in which order
How to load a class at run time
Select the correct option that shows the error in the following Java code.
How many objects can be created of an abstract class in a java program?
How many times 'Hello' is printed?
public class abekus {
public static void main(String[] args){
for(int i = 0; i<5; i++)
{
System.out.println("Hello");
break;
}
}
}
class test{
public static void main (String[] args) {
int x=10,y=15;
if(x++<=10 && ++y>15)
{
x++;
}
else
{
y--;
}
System.out.println(x+" "+y);
}
}
Predict the output of the following Java code:
import java.lang.*;
public class Abekus {
public static void main(String[] args)
{
long l = 4;
System.out.println(Long.numberOfTrailingZeros(l));
}
}
What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
Double x = Double.MAX_VALUE;
System.out.print(x);
}
}
Predict the output of the following Java code.
class Abekus {
public static void main(String[] args)
{
int if_var = 23;
int else_var = 89;
int switch_var = 45;
System.out.println(if_var + " " + else_var + " " + switch_var);
}
}
Statement 1- Elementat methods are used to retrieve the elements in properties object at a specific location
Statement 2- Elementat methods are used to retrieve the elements in properties object at a specific location
What will be the output of the following code?
class A
{
public static void main(String args[])
{
int arr[] = {0 ,10, 20, 30, 40, 50};
for (int k = 1; k < arr.length - 2; ++k)
System.out.print(arr[k] + " ");
}
}
import java.util.*;
class output
{
public static void main(String args[])
{
Stack obj = new Stack();
obj.push("A");
obj.push("B");
obj.push("C");
obj.push("D");
System.out.println(obj.search("D"));
}
}
What will be the output of the program?
public class Abukes
{
public static int y;
public static void foo(int x)
{
System.out.print("foo");
y = x;
}
public static int bar(int z)
{
System.out.print("bar");
return y=z;
}
public static void main(String [ ] args)
{
int t=0;
assert t > 0 : bar(7);
assert t > 1 : foo(8);
System.out.println("done ");
}
}
class check
{
int radius,result;
void Area(int radius)
{
result = 22/7*radius*radius;
}
}
public class output{
public static void main(String args[])
{
check obj = new check();
obj.Area(11);
System.out.println(obj.result);
}
}
What will be the output of the following code?
class A
{
int i;
}
class B extends A
{
int j;
void display()
{
super.i = j + 10;
System.out.println(i + " " + j);
}
}
class inheritance
{
public static void main(String args[])
{
B obj = new B();
obj.i=10;
obj.j=20;
obj.display();
}
}
What will be the output of the program?
public class Test
{
public static void aMethod() throws Exception
{
try /* Line 5 */
{
throw new Exception(); /* Line 7 */
}
finally /* Line 9 */
{
System.out.print("finally "); /* Line 11 */
}
}
public static void main(String args[])
{
try
{
aMethod();
}
catch (Exception e) /* Line 20 */
{
System.out.print("exception ");
}
System.out.print("finished"); /* Line 24 */
}
}