How many public classes can be present in a java source file?
What is the output of the following Java code?
Which of these methods of the StringBuffer class is used to find the length of the current character sequence?
Which of the following is a type of polymorphism in Java?
float x=12.8;
Which of the following is a correct way to convert the value of x to an integer and store the result in the variable y?
public class abekus{
public static void main(String[] args){
int a = 5;
a +=5;
switch(a){
case 5: System.out.print("5"); break;
case 10: System.out.print("10");
default: System.out.print("0");
}
}
}
Statement 1- Vector is an interface
Statement 2- Iterable is an Interface
Statement 3- List is a class
Statement 4- vector is an Interface
What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double y = new Double(257.57812);
Double i = new Double(257.578123456789);
try
{
int x = i.compareTo(y);
System.out.print(x);
}
catch(ClassCastException e)
{
System.out.print("Exception");
}
}
}
// Predict the output
import java.util.Scanner;
class Main
{
public static void main (String[] args)
{
int arr[] = {10, 20, 30, 40};
int a = 50;
call(a, arr);
System.out.println(a);
System.out.println(arr[0]);
System.out.println(arr[1]);
}
public static void call(int a, int arr[])
{
a = a + 2;
arr[0] = 100;
arr[1] = 200;
}
}
What is the output of the following java program?
class Abekus {
public void show() {
System.out.println("Abekus::show() called");
}
}
class Derived extends Abekus {
public void show() {
System.out.println("Derived::show() called");
}
}
public class Main {
public static void main(String[] args) {
Abekus a = new Derived();;
a.show();
}
}