Java Black Book Title Chapter 10: 10.24 (Implementing the Character class) provides the Character class in the Java library to give you its own implementation of this class (name the new class MyCharacter)

tags: Java black paper after class questions  java

Code explanation

This is to distinguish different topics.

Break the question

The "broken" here is different from what I wrote before, not a verb, not to solve the problem
Instead
Obviously this question is not serious at all
Method of the CHARACTER class:




Below can be taken below
Calculate a 12 method in Figure 12, and there are 72 methods to cut 6 pictures
How do I write? Intersection Intersection
So I can't help it, I can only enjoy the common methods of the Character class
Fortunately, there are other bloggers who have summarized it all at once
Link
Because I didn’t get authorized, I won't post it.
However, the form he or she summarizes is a bit problematic, the method is the method, not with the front "." (For the method)

Code

public class Test24_MyCharacter {
    // Isletter
    public boolean isLetter(char ch){
        int toASCII = (int) ch;
        boolean bool;
        if ((toASCII >= 65 && toASCII <= 90) || (toASCII >= 98 && toASCII <= 133))
            bool = true;
        else
            bool = false;
        return bool;
    }
    // Isdigit a number
    public boolean isDigit(char ch){
        int toASCII = (int) ch;
        boolean bool;
        if (toASCII >= 48 && toASCII <= 57)
            bool = true;
        else
            bool = false;
        return bool;
    }
    // Isletterordigit Is it a letter or number
    public boolean isLetterOrDigit(char ch){
        boolean bool1 = isDigit(ch);
        boolean bool2 = isLetter(ch);
        return bool1 || bool2;
    }
    // IswhiteSpace judgment whether it is a space (space ASCII code is 32)
    // The problem appeared here: Refer to the two spaces in the article.
    public boolean isWhitespace(char ch){
        return (int) ch == 32;
    }
    // Isuppercase Is it a lowercase
    public boolean isUpperCase(char ch){
        int toASCII = (int) ch;
        boolean bool;
        if (toASCII >= 98 && toASCII <= 133)
            bool = true;
        else
            bool = false;
        return bool;
    }
    // Is ISLOWERCASE
    public boolean isLowerCase(char ch){
        int toASCII = (int) ch;
        boolean bool;
        if (toASCII >= 65 && toASCII <= 90)
            bool = true;
        else
            bool = false;
        return bool;
    }
    // Toppercase
    public char toUpperCase(char ch){
        char feedback;
        int toASCII = (int) ch;
        if (toASCII >= 98 && toASCII <= 133)
            feedback = (char) (toASCII - 33);
        else
            feedback = ch;
        return feedback;
    }
    // TOLOWERCE
    public char toLowerCase(char ch){
        char feedback;
        int toASCII = (int) ch;
        if (toASCII >= 65 && toASCII <= 90)
            feedback = (char) (toASCII + 33);
        else
            feedback = ch;
        return feedback;
    }
    // getnumericValue to get the value of the character CH
    public int getNumbericValue(char ch){
        int i = ch;
        return i;
    }
    // Tostring
    public String toString(char ch){
        return ch+"";
    }
}

Intelligent Recommendation

Java Notes: Character class

Character introduction The Character class is used to manipulate a single character. The Character class wraps the value of a primitive type char in an object When passing a parameter of type char to ...

Java character class

The Character class wraps the value of the base type char. Boxing and unboxing method description isLetter() Is it a letter? isDigit() Is it a numeric character? isWhitespace() Is it a blank character...

Java Character class (11)

The Character class is used to manipulate a single character. The Character class wraps the value of a primitive type char in an object instance: However, in the actual development process, we often e...

019-Java Character class

The Character class is a wrapper class for the char base type and is used to manipulate a single character. The basic types of char are used as follows: Simple example: Character method No. | Method |...

[Tutorial] Java Character class

forward from   Character class for pairSingle characterTake action. Character class wraps a primitive type in an objectcharValue However, in the actual development process, we often encounterNeed...

More Recommendation

[Java] Character class

The method of the Java Character class: Serial number Method and description 1 IsLetter() is a letter (whether it is a text, not including symbols) 2 IsDigit() is a numeric character 3 IsWhitespace() ...

(Java common class) Character

The Character class wraps the value of a primitive type char in an object In addition, this class provides several methods to determine the type of characters (lowercase letters, numbers, etc.) and co...

Java --Character class

This section focuses on the mind map   Character class operation for a single character. Character packaging a base class in an object typechar The value   ExperienceYou need to use objectsI...

Character class in Java

The Character class wraps a value of the basic type char in the object. An object of type Character contains a single field of type char. First, the construction method Character(char value) The const...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top