Java String methods practice programme .
public class nilesh{
public static void main(String args[]){
String name ="Harry";
String n ="Nilesh";
// YOU CAN UNCOMMENT ONE BY ONE AND CHECK THE RESULT AND LEARN
// System.out.println(name.length());
// System.out.println(name.toLowerCase());
// System.out.println(name.toUpperCase());
//String nontrimmedstring =" harry ";
//System.out.println(nontrimmedstring.trim());
//System.out.println(name.substring(1,4));
//System.out.println(n.replace('N','P'));
//System.out.println(name.startsWith("Ha"));
//System.out.println(name.endsWith("rry"));
// System.out.println(name.charAt(4));
// System.out.println(name.indexOf ('H'));
// System.out.println(name.indexOf("y",0));
// System.out.println(name.lastIndexOf ('r',4));
// System.out.println(name.equals("Harry"));
// System.out.println(name.equalsIgnoreCase("harry"));
// Escape Sequence characters there are four escape sequence charachers eg. \n, \t, \' , \\
// System.out.println("Hello My \'name is NIlesh Deore ");
}}
Comments
Post a Comment