The append function is used to update the value of object ,string or numbers. We can also update the value of an object with += operator but in this example we used append function. First we declare a bufferstring and store a name in that, after this asked user to write few lines through input stream and then display all stuff with previous string.
Source Code
import java.util.Scanner; public class String_Functions{ public static void main(String[] args) { Scanner input = new Scanner (System.in); StringBuffer name = new StringBuffer (" LEP "); String intro = ""; System.out.println(" Enter Your Feed Back About LEP !"); intro = input.nextLine(); System.out.println(); System.out.println(name.append(intro)); } }
0 comments:
Post a Comment