TechShiksha by Badkul Technology
前往频道在 Telegram
https://www.youtube.com/@TechShikshaBT Learn Java programming for free Free hand written notes Free ebooks Free assignment support Paid assignment support
显示更多4 972
订阅者
-424 小时
-147 天
-6330 天
帖子存档
using same logic can you write a program to remove a character from a string ?
Repost from TechShiksha by Badkul Technology
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
Repost from TechShiksha by Badkul Technology
find our all latest quizzes at https://www.youtube.com/c/FrbJava/community
public class RemoveSpacesFromString {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
System.out.println(firstApproach(str));
System.out.println(secondApproach(str));
}
private static String secondApproach(String str) {
String strWithoutSpaces ="";
for(int i=0; i<str.length(); i++) {
if(str.charAt(i)!=' ') {
System.out.println("after "+i+"th iteration "+strWithoutSpaces);
strWithoutSpaces +=str.charAt(i);
}
}
return strWithoutSpaces;
}
private static String firstApproach(String str) {
return str.replaceAll(" ", "");
}
}
Can you write a class if description is given? Along with getters and setters, toString, constructors?
find our all latest quizzes at https://www.youtube.com/c/FrbJava/community
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
#Quiz_Java (Question - 117)
Method overriding is combination of inheritance and polymorphism?
Check our poll here on the web
You can now access our java quizzes on youtube community
https://www.youtube.com/c/FrbJava/community
#Quiz_Java (Question - 116)
How to exit an inner loop?
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
You can now access our java quizzes on youtube community
https://www.youtube.com/c/FrbJava/community
Guys help is reach 1k subscribers to start live classes
https://www.youtube.com/c/FrbJava
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
How to exit a loop without completely running it?
