Java Video Tutorial 13

Code is Here:

Best Java Book :

In this part of the Java Video Tutorial I cover most every method available for manipulating Strings and StringBuilders.






42 responses to “Java Video Tutorial 13”

  1. Irfan Khan Avatar

    very nice tutorial derek. But you didn't showed the reverse function in strings. please show how to use reverse function in strings…thnks.

  2. Steven Barnes Avatar

    Instead of saying…  String longString = Long.toString(bigByte); You can say… String longString = bigByte + "";Hope that helps someone.

  3. xXx_The_Bus_Driver_xXx M8 Avatar

    I wish you were my programming teacher at college :)i

  4. Little Maggot Avatar

    what is the difference between size and length?

  5. Little Maggot Avatar

    why do i have to type in Array.toString() to be able to print out the array? why not just System.out.println(letterArray);?

  6. King Shet Avatar

    i fucking love your tutorials

  7. Mazen Sharkawy Avatar

    Was allured by a 3 minutes video made by an Indian guy but his accent brought me back here. Sorry Derek , last time

  8. Eugene Kuzmov Avatar

    9:45 why do you need to print it toString? For a nice looking?

  9. czarnymatigos Avatar

    hello Derek,
    great videos. I'm watching the whole series. You are the best teacher 😉

    Derek, I'm also have an small problem. I am newbie in programing and i see your Eclipse is displaying an explanation how each methods you type into the code work (yellow window next to the window that pops out when you click ctrl +space).
    I guess for a newbie like me is really useful option. I can;t find such option in my eclipse. Can You tell me how to turn it on?

  10. Juha Airaksinen Avatar

    Oh my goodness I made a accidental discovery.. There are short cuts typing "sysout" and pressing "CTRL + SPACE" gives you System.out.println() I gotta learn some of these these are so good 🙂

  11. BCwithPC Avatar

    Hello Derek, I was wondering what age do you think is best to learn programming, and when did you start learning?

  12. sharma mayank Avatar

    Hi, Thanks for Wonderful tutorial
    Sir do you have any tutorial for Springs ?

  13. TheBlue8ird Avatar

    Derek you said that if the letters come before the moreLetters in the compareTo method, it'll print a negative number, but why? letters IS before moreLetters..
    EDIT: Whenever I do StringBuilder randSB = new StringBuilder("Defining stuff");
    it tells me "the constructor StringBuilder is undefined"

  14. siddhartha das Avatar

    Hi Derek
    Your tutorials are simply phenomenal. Thank you very much for these tutorials. How these videos only have about 54000 views i don't know. I guess not enough people are learning java 😉

  15. Jitesh Narula Avatar

    Dear Sir,

    Does java put anything at the end of the String like in C/C++ we have Null Character() ??

    Sir Please Reply .
    Thanks in advance!

  16. adi elisha Avatar

    thanks alot. really helpful videos.

  17. Apex Window Cleaning Services Avatar

    "A random value" literally LMAO! I hope you realised the joke when you said it Derek.

  18. David Huynh Avatar

    Strings create a new place in memory when you change it's value, instead of overwriting. Is this just how Java works or do strings in other language also work this way?

  19. Michael Prigmore Avatar

    Hi Derek,

    what is the difference between creating a String with: String myString = new String("Hello world!"); AND String myString = "Hello world!";

    Thanks in advance!

  20. C. Drithin Avatar

    append( ), reverse( ), subsequence( ), are exclusively for stringBuilder

    remaining methods are common for both string and stringBuilder

    Am I right?

    P.S: this is one of important concepts that we may expect questions in 1Z0-803 , oracle java certification. Please clarify 🙂

  21. Mr. Avatar

    thank you so much 🙂 using what i learned from your awesome tutorials i've wrote a rock, paper, scissors program it's the biggest program i wrote in my life. thanks again Derek 🙂

    here's the code.

    import java.util.Scanner;

    // I don't know what's this import for.
    import javax.naming.spi.DirStateFactory.Result;

    public class TheGame {

    static Scanner userInput = new Scanner(;
    static String userAnswer;
    static String ComputerAnswer;
    static String compareResult;

    public static void main(String[] args) {

    System.out.println("rock, paper or scissors?");
    userAnswer = userInput.nextLine();
    System.out.println(compare(ComputerAnswer, userAnswer));


    public static String computerAnswer()
    int randomNum = (int) (Math.random() * 3);

    //String result;
    if (randomNum == 0)
    ComputerAnswer = "rock";
    else if (randomNum == 1)
    ComputerAnswer = "paper";
    ComputerAnswer = "scissors";

    return ComputerAnswer;

    public static String compare(String ComputerAnswer, String userAnswer)
    if (ComputerAnswer.equals(userAnswer))
    compareResult = "it's a Tie";

    else if (ComputerAnswer.equals("rock"))
    switch (userAnswer)
    case "paper":
    compareResult = "paper beats rock";
    case "scissors":
    compareResult = "rock beats scissors";


    else if(ComputerAnswer.equals("paper"))
    switch (userAnswer)
    case "rock":
    compareResult = "paper beats rock";
    case "scissors":
    compareResult = "scissors beats paper";


    else if (ComputerAnswer.equals("scissors"))
    switch (userAnswer)
    case "rock":
    compareResult = "rock beats scissors";
    case "paper":
    compareResult = "scissors beats paper";



    return compareResult;



  22. ZuestTV Avatar

    hi Derek just wanted to say your my favorite youtuber you explain everything very well and in a very direct way, its great you have videos over object oriented design which is the next course im taking, i was wondering if you having any DataStructure tutorials? thanks again Derek 😀

  23. Nathan Olson Avatar

    Hey Derek! I'm 13 and I'm currently very interested in learning how to write Java. One of my goals is to create a action RPG style game. But I get confused pretty easily with allot of the code. So is there anyway you recommend to make this a bit more understandable? Also, do I have to watch all 95 videos to completely understand or would you recommend select topics? Thanks!

  24. iPlayTehGames Avatar

    whats the difference between using a conditional operator like == and .equals when comparing strings?

  25. Alan Avatar

    Derek, would you still say that the link for the best Java book in your description still holds? For example vs a book like Building Java programs by Reges and Stepp? I'm really considering getting the book in your description. Thanks! (Btw I'm a college freshman looking to major in math & CS)

  26. Gorilla Nuttz Avatar

    Really great tutorials thank you very much. Can you tell us more about how you got hired to work for apple?? Sounds interesting! Thank you Derek

  27. Eduardo Lima Avatar

    hi +Derek Banas me again.. nice tutorial.. I will give you my credits on the exam. LOL

  28. Yinong Zhang Avatar

    more clear than my professor's lecture! thank u

  29. Ricky Wright Avatar

    Will you ever play Minecraft with your subscribers? Great video by the way!

  30. Jonecir Souza Avatar

    Hi Dereck.

    Is there a way to automatically remove the line numbers from you code?

  31. James Barber Avatar

    I love your videos they are great
    I got one question
    if you had two strings "james" and "____"
    and you wanted to put say the "m" from james into the other string and replace just that one position how can you do that I've tried replace but it replaces them all because second string are all the same char.

  32. braulio cortés Avatar

    Hey men your are the best……………Really………..

  33. jyerrami Avatar

    Your tutorials are excellent !!! Thank you.

  34. RycastNarm Avatar


  35. Marco Azer Avatar

    I was wondering what would happen if I set the capacity of a string builder to be less than the length, then I tried to print it and it gave me the same string, shouldn't this throw an exception of invalid memory access?

  36. Derek Banas Avatar

    Thank you 🙂 Im very happy to help and always feel free to ask questions.

  37. baboloki tirelo Avatar


  38. Derek Banas Avatar

    They are called methods or functions if you prefer that better.

  39. Beat Horst Avatar

    Probably the best java tutorial ever, thanks a lot 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *