Wednesday, June 19, 2019

How do you reverse any string without using any function

Just loop for strings length in reverse order, use pick each character from last index to first and concatenate into single string


Please add your answer in comment section 

How do you remove all white spaces from a give. String

Use StringTokenizer with default constructor and retrieve and concatenate all the tokens into a single string.

On quora

Wednesday, March 20, 2019

float vs double

float

If we want 5 to 6 decimal places of accuracy then we should go for float.

Float data type is a single-precision 32-bit IEEE 754 floating point.

Float is mainly used to save memory in large arrays of floating point numbers.

Default value is 0.0f.

Takes 4 bytes to store a variable.

Range is -3.4 E38 to +3.4 E3

double

If we want 15 to 16 decimal places of accuracy then we should go for double.

double data type is a double-precision 64-bit IEEE 754 floating point.

This data type is generally used as the default data type for decimal values, generally the default choice.

Default value is 0.0d.

Takes 8 bytes to store a variableRange is -1.7 E308 to +1.7 E308