All Questions
13 questions
1
vote
2
answers
290
views
Optimize printing massive strings to System.out with respect to time
I need to cut the time it takes to print a large string by ~50%.
I went from using s1 + s2 to using StringBuilder, and instead ...
0
votes
1
answer
692
views
Java exercise: String processing and type conversion
The exercise is from a Java-course in which I'm enrolled.
The classes Book and APIResponseParser were provided by the instructor.
For Book I had to add just a few getter- and setter-methods.
For ...
0
votes
2
answers
2k
views
Data structure to count occurrences of words
I have some code for a assignment where the main marks are awarded based on efficiency. The program uses a given wordgenerator which generates random words and adds them to a user-made data structure. ...
2
votes
1
answer
4k
views
Case-insensitive replacement of "java" with "JAVA" using String.substring()
Assignment:
Create a program Substitute that gets a sentence from the user and replaces every occurrence of the word java (uppercase, lowercase, or a combination) with JAVA. You may not change the ...
1
vote
1
answer
1k
views
Find all occurrences of the word "the" without using regex
I have an assignment to find all occurrences of the word "the" without using regex:
Use the indexOf method to do this. The word "the" could also appear in a ...
1
vote
4
answers
97
views
Form a [email protected] address, eliminating diacritics from a name
I'm an amateur programmer who just started learning programming, my school gave me an assignment to create code that reads a surname and lastname from an input dialog box and then to edit those name ...
-2
votes
2
answers
673
views
Manipulating strings and character positions
Write a program that manipulates two strings. The program inputs two
strings (string1 and string2) and a character (...
5
votes
4
answers
16k
views
Word Guessing Game
I'm trying to learn Java (albeit rather slowly). I'm in a computer science class at my highschool and I've written this little bit of code for a project. Basically it is a word guessing game where if ...
4
votes
3
answers
2k
views
Sorting strings in a one dimensional array
What are the better solutions possible?
I have a character array with different strings. There is a max size for the strings. In case a string is smaller than max size remaining places are filled ...
11
votes
8
answers
18k
views
Return a string without the first two characters
I'm new to Java and am trying to solve a scenario. Even though I've succeeded and it works, I've just wondered if there was a more practical way of doing this task. Is there a quicker or more ...
0
votes
1
answer
121
views
Processing a string from the console
How can I make this program run faster? On enter, I have a string from the console. For example:
1 1 7 3 2 0 0 4 5 5 6 2 1
On exit, it will be
...
2
votes
1
answer
218
views
High School Java Class: Pong Project External Reviewer
It would be a huge help if you could tell me ways to make my code run smoother and if I could add more code to my program to make my program more unique.
Panelball class:
...
8
votes
3
answers
20k
views
Replace multiple occurrences of a character
I try to replace multiple occurrences of a character with a single character.
Input:
hhiii!!! hooowww aaareee yyyooou???
Output:
hi! how are you?
...