Showing posts with label what is String append function in Java. Show all posts
Showing posts with label what is String append function in Java. Show all posts

Friday, 5 September 2014

String APPEND FUNCTION in Java

Structure of the Problem Requirements 

In this problem we will discus about the string append function in Java program. 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. Here is the source code of this example which help you in better understanding.

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));
}  
 }

Output of the Program

append function
append function with string in Java