Arrays in Java are implemented as?
class
object
variable
none of the mentioned
SHOW ANSWERWhich of these keywords is used to prevent content of a variable from being modified?
final
last
constant
static
SHOW ANSWERWhich of these cannot be declared static?
class
object
variable
method
SHOW ANSWERWhich of the following statements are incorrect?
static methods can call other static methods only
static methods must only access static data
static methods can not refer to this or super in any way
when object of class is declared, each object contains its own copy of static variables
SHOW ANSWERWhich of the following statements are incorrect?
Variables declared as final occupy memory
final variable must be initialized at the time of declaration
Arrays in java are implemented as an object
All arrays contain an attribute-length which contains the number of elements stored in the array
SHOW ANSWERWhich of these methods must be made static?
main()
delete()
run()
finalize()
SHOW ANSWERWhat is the output of this program?
class Output
{
public static void main(String args[])
{
int arr[] = {1, 2, 3, 4, 5};
for ( int i = 0; i < arr.length - 2; ++i)
System.out.println(arr[i] + " ");
}
}
a)1 2
b) 1 2 3
c) 1 2 3 4
d) 1 2 3 4 5
128. What is the output of this program?
class Output
{
public static void main(String args[])
{
int a1[] = new int[10];
int a2[] = {1, 2, 3, 4, 5};
System.out.println(a1.length + " " + a2.length);
}
}
10 5
5 10
0 10
0 5
SHOW ANSWERString in Java is a?
class
object
variable
character array
SHOW ANSWERWhich of these method of String class is used to obtain character at specified index?
char()
Charat()
charat()
charAt()
SHOW ANSWERWhich of these keywords is used to refer to member of base class from a subclass?
upper
super
this
none of the mentioned
SHOW ANSWERWhich of these method of String class can be used to test to strings for equality?
isequal()
isequals()
equals()
equal()
SHOW ANSWERWhich of the following statements are incorrect?
String is a class
Strings in java are mutable
Every string is an object of class String
What is the output of this program?
class string_demo
{
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}
I
Java
IlikeJava
SHOW ANSWER