1. Technology
Describe the significance of the immutability of String objects.

What is the replace() method?
The replace() method is a method of the String class. This method takes two character arguments. It creates a new string after replacing all the occurrences of a particular character in the string with another character. The string that invokes this method remains unchanged. The general form of the method is given below:

public String replace(char old_char, char new_char)

What is the charAt() method?
The charAt() method is used to obtain a character from a string at the specified index. The general format of the method is given below:

public char charAt(int location)

Note: The first character in a string is at index 0 and the last character is at index length() -1.

Describe the significance of wrapper classes, including making appropriate selections in the wrapper classes to suit specified behavior requirements, stating the result of executing a fragment of code that includes an instance of one of the wrapper classes, and writing code using the following methods of the wrapper classes (e.g., Integer, Double, etc.): doubleValue, floatValue, intValue, longValue, parseXxx, getXxx, toString, toHexString.

What is the Boolean class?
The Boolean class is a wrapper class that is used to wrap true or false type primitive values in a Boolean object.
This class defines two constructors with the following signatures:

public Boolean(boolean bool_value)
public Boolean(String str)

The first form of the constructor takes a primitive type boolean as an argument, whereas the second form takes a string argument.

Most often, the second form of the constructor is used. It creates a Boolean object representing a true value if the argument passed as a string is "true", ignoring the case of the string. Otherwise, it creates a Boolean object representing a false value.

What is the booleanValue() method?
The booleanValue() method is defined only in the java.lang.Boolean class and no other wrapper class. This method is used to convert the value wrapped by the Boolean object into a primitive type boolean.

The method has the following signature:

public boolean booleanValue()

This method takes no argument. It returns the value wrapped by the Boolean object from which it is called by using a dot (.) operator. The value returned by the method is a primitive type boolean.

What is the parseInt() method?
The parseInt() method is a static method of the Integer class. Two versions of the parseInt() method are defined in the Integer class. Their signatures are given below:

public static int parseInt(String str) throws NumberFormatException
public static int parseInt(String str, int base) throws NumberFormatException

The first form of the parseInt() method returns an integer representation of the number contained in the string argument as a signed decimal integer.

The second form of the parseInt() method returns an integer representation of the number contained in the string arguments by using the specified base.

Both of the methods throw an object of type NumberFormatException in case the string passed as an argument to the method does not contain a parsable int type number.

The Collections Framework

Make appropriate selection of collection classes/interfaces to suit specified behavior requirements.

Distinguish between correct and incorrect implementations of hashcode methods.

What is the hashCode() method?
The hashCode() method is defined in the java.lang.Object class. It returns the hash code of the invoking object. The hash code value returned by this method is a number of type int. The signature of the hashCode() method is given below:

public int hashCode()

Note: Objects that are equal according to the equals(Object) method always produce the same hash code value. However, it is not necessary for the objects that are unequal according to the equals(java.lang.Object) method to produce different hash code values.

  1. About.com
  2. Technology
  3. Tech Certification
  4. All Certifications
  5. Java
  6. SCJP Exam CX 310-035 Study Notes

©2014 About.com. All rights reserved.