Question 11
EasyWhich method returns the number of characters in a Java String s?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Programming Languages
Which method returns the number of characters in a Java String s?
s.length()
s.length
s.count()
s.size()
Sign up free to see the answer and a step-by-step explanation.
Which method should be used to compare the contents of two Java Strings?
equals()
same()
compare()
==
Sign up free to see the answer and a step-by-step explanation.
What does JDK stand for?
Java Development Kit
Java Data Kernel
Joint Development Kit
Java Debug Key
Sign up free to see the answer and a step-by-step explanation.
Which Java collection does not allow duplicate elements?
Vector
LinkedList
HashSet
ArrayList
Sign up free to see the answer and a step-by-step explanation.
Which Java loop always runs its body at least once?
for-each
do-while
for
while
Sign up free to see the answer and a step-by-step explanation.
What is autoboxing in Java?
Converting a String into an array
Automatic conversion of a primitive, such as int, into its wrapper object, such as Integer
Packing classes into a JAR file
Automatic creation of a GUI window
Sign up free to see the answer and a step-by-step explanation.
Which Java package is imported automatically into every program?
java.lang
java.util
java.net
java.io
Sign up free to see the answer and a step-by-step explanation.
Why is Java called platform-independent?
It is written in HTML
It runs only on Windows
It needs no compiler
It compiles to bytecode that runs on any system with a JVM
Sign up free to see the answer and a step-by-step explanation.
Which Java type would you use to store a whole number larger than about 2.1 billion?
byte
short
int
long
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
System.out.println(10 + 20 + "Hi");
}
}
Hi1020
30Hi
Sign up free to see the answer and a step-by-step explanation.
Hi30
1020Hi