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 with string in Java |
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
Why we need Buffer for that Programmed, However is it too difficult ???
ReplyDelete