Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Useful string methods in Java! 🧵
Play lesson

Java tutorial for beginners ☕ - Useful string methods in Java! 🧵

5.0 (4)
40 learners

What you'll learn

This course includes

  • 12 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#java #javatutorial #javacourse public class Main { public static void main(String[] args) { String name = "Bro Code"; int length = name.length(); char letter = name.charAt(0); int index = name.indexOf(" "); int lastIndex = name.lastIndexOf("o"); name = name.toUpperCase(); name = name.toLowerCase(); name = name.trim(); name = name.replace("o", "a"); if(name.isEmpty()){ System.out.println("Your name is empty"); } else{ System.out.println("Hello " + name); } if(name.contains(" ")){ System.out.println("Your name contains a space"); } else{ System.out.println("Your name DOESN'T contain any spaces"); } if(name.equalsIgnoreCase("password")){ System.out.println("Your name can't be password"); } else{ System.out.println("Hello " + name); } } }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere