Which methods can be used to convert all characters in a string into character array?
This section of our 1000+ Java MCQs focuses on character extraction of Java Programming Language. 1. Which of these method of class String is used to extract more than one character at a time a String object? Answer: d 2. Which of these methods is an alternative to getChars() that stores the characters in an array of bytes? Answer: a 3.
In the following Java code, what can directly access and change the value of the variable name? a) any class Answer: c 4. What will be the output of the following Java code?
a) The value “4” is printed at the command line Answer: d 5. Which of these methods can be used to convert all characters in a String into a character array? Answer: c 6. What will be the output of the following Java code?
a) Hello, i love java Answer: d $ javac output.java
$ java output
llo i l 7. What will be the output of the following Java code?
a) 6 4 6 9 Answer: a $ javac output.java $ java output 6 4 6 9 8. What will be the output of the following Java code?
a) a is a lower case Letter is White space character b) b is a lower case Letter is White space character c) a is a lower case Letter A is an upper case Letter d) a is a lower case Letter 0 is a digit View Answer Answer: c $ javac output.java $ java output a is a lower case Letter A is an Upper Case Letter 9. What will be the output of the following Java code?
a) h Answer: b $ javac output.java
$ java output
e Sanfoundry Global Education & Learning Series – Java Programming Language. Next Steps:
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn. Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses. How do I convert a string to an array of arrays?There are four ways to convert a String into String array in Java:. Using String. split() Method.. Using Pattern. split() Method.. Using String[ ] Approach.. Using toArray() Method.. Which methods can be used to convert all characters?upper() method on a string converts all of the characters to uppercase, whereas the lower() method converts all of the characters to lowercase.
Which method converts string into array?String class split(String regex) can be used to convert String to array in java. If you are working with java regular expression, you can also use Pattern class split(String regex) method. Let's see how to convert String to an array with a simple java class example.
Which methods can be used to convert all characters in a string into a character Amay?Which of these methods can be used to convert all characters in a String into a character array? Explanation: charAt() return one character only not array of character.
|