0% found this document useful (0 votes)
10 views

Advanc Java

hfelhdeklhdelhdeihfeihlhkld

Uploaded by

kp6688479
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Advanc Java

hfelhdeklhdelhdeihfeihlhkld

Uploaded by

kp6688479
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

21.

Identify the output of the following program.

String str = “Hellow”;


System.out.println(str.indexOf(‘t));
0

true

-1

22. Identify the output of the following program.

Public class Test{


Public static void main(String argos[]){
String str1 = “one”;
String str2 = “two”;
System.out.println(str1.concat(str2));
}
}
one

two

onetwo

twoone

23. What does the following string do to given string str1.

String str1 = “Interviewbit”.replace(‘e’,’s’);

Replaces single occurrence of ‘e’ to ‘s’.

Replaces all occurrences of ‘e’ to ‘s’.

Replaces single occurrence of ‘s’ to ‘e’.

None.
24. .
To which of the following does the class string belong to.

java.lang

java.awt

java.applet

java.string

25. How many objects will be created in the following?

String a = new String(“Interviewbit”);


String b = new String(“Interviewbit”);
Strinc c = “Interviewbit”;
String d = “Interviewbit”;
2

None

26. Total constructor string class have?

13

20
27. Find the output of the following code.

int ++a = 100;


System.out.println(++a);
101

Compile error as ++a is not valid identifier

100

None

28. Find the output of the following code.

if(1 + 1 + 1 + 1 + 1 == 5){
System.out.print(“TRUE”);
}
else{
System.out.print(“FALSE”);
}
TRUE

FALSE

Compile error

None

29. Find the output of the following code.

Public class Solution{


Public static void main(String… argos){
Int x = 5;
x * = (3 + 7);
System.out.println(x);
50

22
10

None

30.. Identify the return type of a method that does not return any
value.

int

void

double

None

You might also like