[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given an array of Strings, return a single String that is made up of all strings...
Search Results
Searching for: String
Individual Exercises
Design a recursive method for scrambling Strings of length 3 or more. It must swap the first and last character of the input String, then...
Complete the method below for evaluating the substring of any string. If the given string is empty, return "Empty". If the parameters are...
What will be the output of the following code?
public class Answer { System.out.println("Hello World!".substring(6)); }
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Write a function in Java that implements the following logic: Given a string,...
The method wabbajack()
is defined as follows:
public String wabbajack(String input) { if (input.length() < 5) { return "Rabbit"; }...
Complete this method to return the two String parameters combined (concatenated) together.
Complete this method to print the two String parameters combined (concatenated) together.
This method takes a String object as a parameter and returns a compressed version of the object. The method compresses the String by...
This methods takes a String object as a parameter and returns an encrypted version of the object. The encryption is done in two steps:...
this method accepts a String object as a parameter. It returns true if the String has all unique characters, false otherwise. For...
declare a variable with the appropriate data type to have a statement that says: “Good Morning.” Use the variable you created in the...
This method takes an ArrayList of Strings as a parameter and returns the longest String in the list. If the list is empty, it should...
This method takes an ArrayList of Strings as a parameter and returns the length of the longest String in the list. If the list is empty,...
Complete the function countStrLongerThan()
so that it returns the count of Strings in the array names
that are longer than minLen
. You...
Complete the function countStrings()
so that it returns the count of Strings in the array names
that are not null
.
Complete the function countStrLongerThan()
so that it returns the count of Strings in the array names
that are longer than minLen
. You...
Declare a String variable, name it student
and assign it the value "Malcolm".
Write a function called repeat(s, n)
with two parameters, a String s
and an int n
. The routine should return a string with s
repated n
...
Write a function untilSpace(s)
that returns a substring of s
starting at the beginning and extending until a space is found. The space is...
Given an array of integers, return the largest value in the array. Assume the array has only posivitive numbers. If the array is empty,...
Write a function first10(s)
that returns the first 10 characters of s
. If s
is longer than 10 characters, just truncate it. If s
is...
Given an array of Strings, return the longest String in the array. If the array is empty, return null.
Write a function fullWords(s)
that returns a string no longer than 20 characters. If the string s
is longer than 20 characters, just...
Rewrite the following while
loop using a for
loop.
call_a(); while (call_b()) call_c();