Thursday, 19 February 2015

String Class

package com. sravan.corejava.string;

public class StringClass {
public static void main(String[] args) {

// 1.charAt - returns a charecter at specified position
// String string = "hello";
// System.out.println(string.charAt(0));

// 2.codePointAt - returns a ascii value of specified position
// String string = "aello";
// System.out.println(string.codePointAt(0));

// 3.codePointAtBefore - returns a ascii value of before specified
// position
// String string = "hello";
// System.out.println(string.codePointBefore(1));

// 4.codePointCount-This method returns the number of Unicode code
// points in the
// specified text range.
// String string = "hello";
// System.out.println(string.codePointCount(0, 2));

String string = "hello";
String string2 = "hellonari";
int a = string.compareTo(string2);
System.out.println(a);

// string.in

}
}

No comments:

Post a Comment