Start learning now
You've leveled up!
You've leveled up!
What are mutable/immutable objects, and what are they for?
Hi, Amigo! Hi, Bilaabo! Today Bilaabo will tell you about mutable andimmutable objects. Objects you can change after they are created are called mutable. Objects that cannot be changed after they are created are called immutable What determines whether I can change an object?
I list all of the classes associated with strings, and explain what they and all their methods do
"Hi, Amigo!" "But, Bilaabo, you've already said hello." "Really? Well, I still like starting each lesson with that phrase." "Today we're going to study the String class in depth." "But, I already know everything about it. I even know that the String class is immutable." "The String class has 46 methods. How many of them do you know?" "No more than ten. Actually, probably about 5 max." "Then listen up." "Java's creators noticed that most ..."
String's inner workings, and the substring method
"Hi, Amigo!" "Hi, Ellie." "I'm going to tell you about substrings. A substring is a part of a string. And the most common operation performed on strings (after combining several strings together) is obtaining a substring." How do I get part of a String? "The substring method returns part of a String. This method has two versions." "The first version returns the substring specified by starting and ending indices. But the character at the ending index ..."
Finding, retrieving, and deleting substrings
"Check out some other things you can do with substrings: How do I find a substring? The indexOf and lastIndexOf methods let you search for strings within strings. There are 4 versions of these methods: The indexOf method looks for a string in a specified String. The method can search for the string from the beginning of the specified String, or starting from some index (the second method). If the string is found, then the method returns ..."
Practice finding and retrieving substrings
"Hi, Amigo!" "You won't believe it. I just finished all the tasks for you!" "Sweet! Thanks, Diego." "But I'm not going to give them to you. So, you do them—it will make you smarter ..."
"I also want to tell you about the String.format method." "It's a static method of the String class, but it is very useful. Let me take a roundabout approach." "If you need to display several variables on one line of text, how would you do it?" "What text?" "This, for example ..."
Practice using String.format
"Hi, Amigo!" "No, Diego, that's enough! Do your own tasks!" "Amigo, buddy. No one is going to do your tasks for you. Do you want to get smarter?" "Yes." "When you're at the gym, you don't ask others to pump iron or do crunches for you, do you?" "No." "Then you should also do all this work by yourself. I've got some very interesting tasks for you this time ..."
StringBuilder and StringBuffer
"We just have to cover StringBuilder, and then I think we're done." "As you already know, StringBuilder is like the String class, except it is mutable." "And I also remember that the compiler generates code that uses StringBuilder when we simply add Strings together." "Yes, you are right. What a remarkable memory you have. Then again, every robot does. I always forget that." "Let's examine what you can do using the StringBuilder ..."
Practice using StringBuilder and StringBuffer
"Hi, Amigo!" "Hi, Diego. You know what, I've decided that everything you do is for my own good." "Thanks for the tasks. I'd be happy to do them ..."
"Hi, Amigo!" "Now it's time for another interesting topic: encodings." "Perhaps you've already heard somewhere that each character has a code (number). That's why the char type can represent both symbols and numbers." "For example, the code for the letter 'A' in the English alphabet is 65. 'B' is 66, 'C' is 67, and so on. There are unique codes for uppercase letters, lowercase letters, Cyrillic letters, Chinese characters ..."
Regular expressions (with examples)
"And now I'll tell you about regular expressions. This topic is both complex and simple at the same time. To thoroughly understand regular expressions, you may need to read two or three hefty books, but I can teach you how to use them right now." "As experienced programmers like to joke, if you have a problem and think you're going to solve it with regular expressions, now you have two problems." "Hmm." "I hope I didn't scare you ..."