Java Tutorial for Beginners 2023 | String Methods in Java | Java String Class | Parnika Tutorials
"Java Tutorial for Beginners 2023 | String Methods in Java | Java String Class | Parnika Tutorials
#stringclass #stringmethod #javastrings #javaclasses #featuresjava #java #javafullcourse #javatutorials #javaforbeginners #javalanguage #learnjava #javacompletecourse #javaprogramming #javatutorialforbeginners #parnikatutorials #javacourse #java2023 #javacourse2023
00:00 - Introduction
00:39 - What is a String
01:28 - How to declare a string
05:39- String methods
46:40 - Implementation of string methods
previous video - #16 COMMAND LINE ARGUMENTS IN JAVA | JAVA COURSE FOR BEGINNERS | JAVA PROGRAMMING
https://youtu.be/iMiNc7qb2lE"
Social media Links:
Instagram: https://www.instagram.com/parnikatutorials/
Website: http://parnikatutorials.in/
Email id: [email protected]
To get the regular updates:
Telegram link: https://t.me/Parnikatutorials
Facebook: https://m.facebook.com/profile.php?id=109245950811428&ref=content_filter
Linkedin: https://www.linkedin.com/in/parnika-tutorials-a8a9831b2/
Pinterest: https://in.pinterest.com/parnikatutorials0892/
String is a sequence of characters. In java, objects of String are immutable which means a constant and cannot be changed once created.
Creating a String
There are two ways to create string in Java:
String literal
String s = “GeeksforGeeks”;
Using new keyword
String s = new String (“GeeksforGeeks”);
String Methods
int length(): Returns the number of characters in the String.
"GeeksforGeeks".length(); // returns 13
Char charAt(int i): Returns the character at ith index.
"GeeksforGeeks".charAt(3); // returns ‘k’
String substring (int i): Return the substring from the ith index character to end.
"GeeksforGeeks".substring(3); // returns “ksforGeeks”
String substring (int i, int j): Returns the substring from i to j-1 index.
"GeeksforGeeks".substring(2, 5); // returns “eks”
String concat( String str): Concatenates specified string to the end of this string.
String s1 = ”Geeks”;
String s2 = ”forGeeks”;
String output = s1.concat(s2); // returns “GeeksforGeeks”
int indexOf (String s): Returns the index within the string of the first occurrence of the specified string.
String s = ”Learn Share Learn”;
int output = s.indexOf(“Share”); // returns 6
int indexOf (String s, int i): Returns the index within the string of the first occurrence of the specified string, starting at the specified index.
String s = ”Learn Share Learn”;
int output = s.indexOf("ea",3);// returns 13
Int lastIndexOf( String s): Returns the index within the string of the last occurrence of the specified string.
String s = ”Learn Share Learn”;
int output = s.lastIndexOf("a"); // returns 14
boolean equals( Object otherObj): Compares this string to the specified object.
Boolean out = “Geeks”.equals(“Geeks”); // returns true
Boolean out = “Geeks”.equals(“geeks”); // returns false
boolean equalsIgnoreCase (String anotherString): Compares string to another string, ignoring case considerations.
Boolean out= “Geeks”.equalsIgnoreCase(“Geeks”); // returns true
Boolean out = “Geeks”.equalsIgnoreCase(“geeks”); // returns true
int compareTo( String anotherString): Compares two string lexicographically.
int out = s1.compareTo(s2); // where s1 ans s2 are
// strings to be compared
This returns difference s1-s2. If :
out -ve // s1 comes before s2
out = 0 // s1 and s2 are equal.
out +ve // s1 comes after s2.
int compareToIgnoreCase( String anotherString): Compares two string lexicographically, ignoring case considerations.
int out = s1.compareToIgnoreCase(s2);
String toLowerCase(): Converts all the characters in the String to lower case.
String word1 = “HeLLo”;
String word3 = word1.toLowerCase(); // returns “hello"
String toUpperCase(): Converts all the characters in the String to upper case.
String word1 = “HeLLo”;
String word2 = word1.toUpperCase(); // returns “HELLO”
String trim(): Returns the copy of the String, by removing whitespaces at both ends. It does not affect whitespaces in the middle.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Tutorial for Beginners 2023 | String Methods in Java | Java String Class | Parnika Tutorials», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.