AmbitionBox

Discover Best Places to work in India

Java Programming

Java Programming Questions and Answers

Showing 61 - 70 of 150 questions

61

Which of these method of class String is used to obtain length of String object?

a

get()

b

sizeof()

c

lengthof()

d

length()

correct answer d
62

Which of these operators can be used to concatenate two or more String objects?

a

+

b

+=

c

&

d

||

correct answer a
63

Which of these methods is used to obtain value of invoking object as a long?

a

long value()

b

long longValue()

c

Long longvalue()

d

Long Longvalue()

correct answer b
64

Which of the following statements are valid array declaration? (A) int number(); (B) float average[]; (C) double[] marks; (D) counter int[];

a

A

b

A & C

c

D

d

B & C

correct answer d
65

Which of the following will output a random with values only from 1 to 10?

a

System.out.println(Math.round(Math.random()* 10));

b

System.out.println(Math.round(Math.random() % 10));

c

System.out.println(Math.random() *10);

d

None of these

correct answer b
66

Which of the following will compile correctly?

a

System.out.println(Math.max(x));

b

System.out.println(Math.random(10,3));

c

System.out.println(Math.round(20));

d

System.out.println(Math.sqrt(10));

correct answer b
67

The exception class is in ____ package

a

java.file

b

java.io

c

java.lang

d

java.util

correct answer c
68

Which keyword is used to monitor statement for exception?

a

try

b

catch

c

throw

d

throws

correct answer a
69

If an exception is generated in try block , then it is caught in ____ block

a

finally

b

throw

c

catch

d

throws

correct answer c
70

______ is a superclass of all exception classes.

a

Exception

b

throwable

c

RuntimeException

d

IOException

correct answer b
Select a company to compare with

vs

Similar Companies