Lec: 8 | JAVA

     

LEC:8

String Functions in JAVA





            






Source Code:
  package lec_5;
import java.util.*;
public class Lec_5 {
public static void main(String[] args) {
        String name="Runway with code";
        System.out.println("The string is : " +name );
        //Length function of string  int java 
        System.out.println("The length of "+ name +"  is  "+name.length());
        //toUpperCase()
        System.out.println("using function to convert into upper case"+ name +"  is  "+name.toUpperCase());
        //toLowerCasecase()
        System.out.println("using function to convert into lower case"+ name +"  is  "+name.toLowerCase());
        
        //to search in the string we use indexof()
        String story=" swati is a good girl, and have knowledge of java";
        System.out.println("The index at which good is found is :  "+story.indexOf("good"));
        System.out.println("The index at which good is found is :  "+story.indexOf("good12"));
        
        //concat() is used to join 2  strings together
        System.out.println("after concatenation  the string is : " + name.concat(story));
        //escape sequence characters ;
        System.out.println("Hey welcome  to RWC \rI hope u get knowledge from there");
        
}       

}

Comments

Popular posts from this blog

RunwayWithCode

web development Lectures

C++ Lectures