Computer Science, asked by podhamchettykomali20, 9 months ago

this object is used to
2. Fill the blank spaces in the following
your answer.
a)
class S1
b
static
function 1(int x)
return x * 5.5;
public static void main()
ans;
ans = function1(2);
System.out.println(ans);
}
Output:​

Answers

Answered by layagiddi
0

Answer:

Mark me add brilliant

Explanation:

removes all whitespaces and non-visible characters (e.g., tab, \n).

st.replaceAll("\\s+","") and st.replaceAll("\\s","") produce the same result.

The second regex is 20% faster than the first one, but as the number consecutive spaces increases, the first one performs better than the second one.

Assign the value to a variable, if not used directly:

st = st.replaceAll("\\s+","")

Similar questions