Master Java Substrings: Build an Email Slicer for Beginners 📧
Learn how to easily extract usernames and domains from emails using Java substrings. Perfect for beginners looking to boost their coding skills! #java #javatutorial #javacourse
🔥 Related Trending Topics
LIVE TRENDSThis video may be related to current global trending topics. Click any trend to explore more videos about what's hot right now!
THIS VIDEO IS TRENDING!
This video is currently trending in Thailand under the topic 'สภาพอากาศ'.
About this video
#java #javatutorial #javacourse
This is a beginner's introduction to substrings and we'll use it to code an email slicer that extracts a username and domain from an email address.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// .substring() = A method used to extract a portion of a string
// .substring(start, end)
Scanner scanner = new Scanner(System.in);
String email;
String username;
String domain;
System.out.print("Enter your email: ");
email = scanner.nextLine();
if(email.contains("@")){
username = email.substring(0, email.indexOf("@"));
domain = email.substring(email.indexOf("@") + 1);
System.out.println(username);
System.out.println(domain);
}
else{
System.out.println("Emails must contain @");
}
scanner.close();
}
}
Video Information
Views
17.5K
Total views since publication
Likes
427
User likes and reactions
Duration
8:05
Video length
Published
Dec 5, 2024
Release date
Quality
hd
Video definition
About the Channel
Tags and Topics
This video is tagged with the following topics. Click any tag to explore more related content and discover similar videos:
#java tutorial #java programming #java course #java substrings #java substring #java email slicer #java email
Tags help categorize content and make it easier to find related videos. Browse our collection to discover more content in these categories.