Answer:
public class num2 {
public static String removeSpaces(String word){
String wordNoSpaces = word.replaceAll(" ","");
return wordNoSpaces;
}
public static void main(String[] args) {
String str = "Hello my name is John";
System.out.println(removeSpaces(str));
}
}
Explanation:
Using Java Prograamming language
- Define the method removeSpaces() to accept a string as parameter and return a string as well
- With the method's body, use Java's built-in method replaceAll() to replace all whitespaces with no spaces String wordNoSpaces = word.replaceAll(" ","");
- Return the resulting string
- In the main method define a string with white spaces
- Call removeSpaces and pass the defined string as an argument
- Output the result
Operating System
Not much context for this questiom but that should be right.
Answer:
The code to this question can be given as:
Code:
//define code.
//conditional statements.
if (Character.isLetter(passCode.charAt(0))) //if block
{
System.out.println("Alphabetic at 0"); //print message.
}
if (Character.isLetter(passCode.charAt(1))) //if block
{
System.out.println("Alphabetic at 1"); //print message.
}
Explanation:
In this code, we define conditional statement and we use two if blocks. In both if blocks we use isLetter() function and charAt() function. The isLetter() function checks the inserted value is letter or not inside this function we use charAt() function that checks inserted value index 1 and 2 is the character or not.
- In first if block we pass the user input value and check the condition that if the inserted value is a character and its index is 0 so, it will print Alphabetic at 0.
- In second if block we pass the user input value and check the condition that if the inserted value is a character and its index is 1 so, it will print Alphabetic at 1.
Answer:
Exactly how many times must the merge function call each of read and write to merge two arrays of size n/2 into an array of size n, assuming
i don t know