Concept explainers
The isDigit, isLetter, and isLetterOrDigit methods are members of this class.
- a. String
- b. Char
- c. Character
- d. StringBuilder
Methods of the class:
The methods “isDigit”, “isLetter”and “isLetterOrDigit” are some of the members of the class “Character”.
Hence, the correct answer is option “C”.
Explanation of Solution
Character class:
- A wrapper class that is used for the char data type is called as “Character” class.
- It contains various method for testing and converting the data that is of character type.
- The character is a part of “java.lang” package and it does not needed to be imported for using the class.
- It contains various static methods for testing the value of the character variables.
Reason for the incorrect answers:
String:
The class is used to represent character of strings.
Hence, the option “A” is wrong.
Char:
“char” is considered as the data type but not the class.
Hence, the option “B” is wrong.
StringBuilder:
The class is used to create a changeable strings and it is similar to String objects.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 8 Solutions
Starting Out with Java: Early Objects (6th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (6th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Database Concepts (8th Edition)
Starting Out with Python (3rd Edition)
Introduction to Programming Using Visual Basic (10th Edition)
Concepts of Programming Languages (11th Edition)
- Python Lab: While still in school, Sam had the ability to solve problems. Now one of his friends' circles wants to check his problem-solving ability so he gave him a problem. Since the Sam does not have time to practice problem solving that is why he fails to solve the question, and he is a great friend of the Sam so ask him to solve the question. I.e.: you are given a list of items N A1, A2. An and you must create a new number by adding no digits to each item in the list. If the number is in front then print "Yes" otherwise print "No". Input 1 3 9 12 111 Output: Noarrow_forwardThe String class is a mutable class. O True O Falsearrow_forwardQ2-Write a java program that has a method called stringDay to display the string named Day based on the number of day entered by the user. The method should take one argument and return a String(name of the (dayarrow_forward
- C sharp Write a method that accepts a string as an argument and checks it for proper capitalization and punctuation. The method should determine if the string begins with an uppercase letter and ends with a punctuation mark. The method should return true if the string meets the criteria; otherwise, it should return false.arrow_forward5. public static String getFlag(int size, char color1, char color2, char color3) - This method returns a string where a triangle appears on the left size of the diagram, followed by horizontal lines. For example, calling DrawingApp.getFlag(9, 'R', '.', 'Y'); will generate the string: R... RRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRRYYYYΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥ YYYYYYYYY RRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRRRRYYYYY YYYYYYYYYYYYY YYYYYYYYY RRRRRRY YYYYYYYYYYYYYYYYY YYYYYYYYY RRRRRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRRRRRRRYY YYYYYYYYYYYYYYYY YYYYYYYYY RRRRRRRRR. RRRRRRRRR. RRRRRRRRYYYYYY rҮҮҮҮҮҮҮҮҮҮҮҮҮҮҮҮҮҮ YYYYYYYYY RRRRRRRYYY ΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥ ΥΥΥΥΥΥΥΥΥ RRRRRRYYY ΥΥΥΥΥΥΥΥΥΥΥΥΥΥΥ YYYYYYYYY RRRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYY RRYYYYYYYY YYYYYYYYYYYYYYYY ΥΥΥΥΥΥΥ The diagram has a number of rows that corresponds to size * 2 and a number of colums that…arrow_forwardpublic String firstAndLast(String str) { //declare and create your first char //declare and create your second char //return your first and last char as a String }arrow_forward
- All the Same Letter Write a method to determine if all the letters in a String are the same letter. public boolean sameLetter(String str) { //declare first character variable //create statements to compare each character and include return statement //create other return statement }arrow_forwardusing Java. Part B – String Classifier (30%) This program will classify a string as one of the following: a palindrome, a repeated word, or “nothing special”. A word is considered repeated if it repeats only once in a string (e.g., “pizzapizza”). Some palindrome examples are: “racecar”, “aa”, and “aaa”. To determine if it is a palindrome, recommend you make use of the below method. Please make sure this program works for all cases and conditions. /** * This method will return a reversed version of the input string */ static String reverseString(String inStr) { String outStr = ""; if (inStr != null) { int startIndex = inStr.length()-1; for (int i=startIndex; i >= 0; i--) { outStr = outStr + inStr.charAt(i); } } return outStr; }arrow_forwardScala Programming: Given string str, write a Scala program to create a new string where "Scala " is added to the front of a given string. If the string already begins with "Scala", return the string unchanged. Otherwise, return the string after adding "Scala ". Test the function for two strings "Scala Programming" and "Programming" inside the main method.arrow_forward
- True or FalseWhen you call a string object’s Split method, the method divides the string into two substrings and returns them as an array of strings.arrow_forwardRest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…arrow_forwardAlternate Character DisplayWrite a method that accepts a String object as an argument and then returns the alternate characters as substring starting from index 0. For instance, if the string argument passed is “GREAT”, the method should return “GET”. Demonstrate the method in a program that asks the user to input a string and then passes it to the method.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT