Anonymous Quiz
40%
byte
17%
char
14%
short
29%
float
👏5👍2
once we complete 1000 subscribers on our youtube channel we will start live streaming of classes
if you have not yet subscribed kindly subscribe to
https://www.youtube.com/c/frbjava
if you have not yet subscribed kindly subscribe to
https://www.youtube.com/c/frbjava
Forwarded from TechShiksha by Badkul Technology
once we complete 1000 subscribers on our youtube channel we will start live streaming of classes
if you have not yet subscribed kindly subscribe to
https://www.youtube.com/c/frbjava
if you have not yet subscribed kindly subscribe to
https://www.youtube.com/c/frbjava
Forwarded from TechShiksha by Badkul Technology
What do you want to learn?
Anonymous Poll
62%
Core java
16%
Advance java
12%
Data structure
5%
Spring boot
1%
Micro services
4%
System design
How to exit a loop without completely running it?
Anonymous Quiz
78%
break statement
10%
quit statement
12%
end statement
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
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
https://www.youtube.com/c/FrbJava/community
Check our poll here on the web
You can now access our java quizzes on youtube community
https://www.youtube.com/c/FrbJava/community
You can now access our java quizzes on youtube community
https://www.youtube.com/c/FrbJava/community
Anonymous Quiz
63%
True
24%
False
10%
Both
3%
None of the above
Newly Joined Members subscribe to our channel to learn programming and crack written exams.
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
https://www.youtube.com/c/frbjava
Discuss doubts in @javaforfree
find our all latest quizzes at https://www.youtube.com/c/FrbJava/community
Can you write a class if description is given? Along with getters and setters, toString, constructors?
Anonymous Poll
76%
Yes
15%
No
9%
Share a video
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(" ", "");
}
}
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(" ", "");
}
}
👍5