Saltar al contenido

métodos de stringbuilder en el ejemplo de código java

Ejemplo 1: generador de cadenas de Java

StringBuilder stringBuilder = new StringBuilder();

stringBuilder.append("string");

System.out.println("String = " + stringBuilder.toString());

Ejemplo 2: para que se usa el constructor de cadenas en java

Java StringBuilder class is used to create
  mutable (modifiable) string. The Java
  StringBuilder class is same as StringBuffer
  class except that it is non-synchronized.
    
StringBuilder()
    creates an empty string Builder with the initial capacity of 16.
StringBuilder(String str)
    creates a string Builder with the specified string.
StringBuilder(int length)
    creates an empty string Builder with the specified capacity as length.

Ejemplo 3: que es stringbuilder

It is mutable char sequence and it is not
thread safe.

Ejemplo 4: constructor de cadenas en java

Java StringBuilder class is used to create
  mutable (modifiable) string. The Java
  StringBuilder class is same as StringBuffer
  class except that it is non-synchronized.
    
StringBuilder()
    creates an empty string Builder with the initial capacity of 16.
StringBuilder(String str)
    creates a string Builder with the specified string.
StringBuilder(int length)
    creates an empty string Builder with the specified capacity as length.

Ejemplo 5: constructor de cadenas en java 8

public StringBuilder reverse()
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *