Apr 16

Write a program to remove characters from starting of String in java

Delete characters from starting of the string in java

To remove some characters from starting of the string we have removeStart() method in StringUtils class.

removeStart() method removes only some characters at the start of the string and returns remaining string.Removes only characters from start of the string only if characters are found. Continue reading

Apr 13

Core java interview questions and answers- part 62

304)Can a boolean primitive value be converted to any other primitive type in java?

 No Boolean primitive cannot be assign to anyother value in java because in boolean type variables we can store only true or false which are literals but not strings.

305) What is autoboxing and autounboxing?

 1)    Java 1.5 introduced a new mechanism called autoboxing and unboxing.

2)    Autoboxing is automatic conversion of primitive type to its corresponding wrapper class objects.

 3)    Autounboxing is the automatic conversion of wrapper object to its corresponding primitive type.

Example : conversion of int primitive to Integer wrapper object.

int i=6;

Integer a=i; Continue reading