Worksheetsstring and Inputstream
Total questions: 10
Worksheet time: 5mins
Choose the correct input stream class
System.io
System.in
System.out
System.InOut
Find the output
String str1="java";
String str2="Java";
System.out.println(str1==str2));
false
true
boolean
equals
Find the output
String str1="JAva";
System.out.println(str1.indexOf('a'));
1
2
3
4
The input read by the using System.in.read() returns what value?
char
ascii
int
float
Which one is correct string declaration?
Char greeting = "Hello";
greeting = "Hello";
String greeting = 'Hello';
String greeting = "Hello";
str1="sona";
System.out.println(str1.charAt(3));
s
o
n
a
WHICH OF THE FOLLOWING CLASS IS USED TO READ INPUT FROM THE USER AT RUNNING TIME?
output
Scanner
scan
input
which method is used to read integer from user?
next()
nextint()
nextInt()
Intnext()
Which method is used for reading string value?
nextchar()
next()
Next()
nextString()
Scanner class is available in which package?
jaa.io
java.lang
java.util
java.java
