StringBuffer

StringBuffer

What's the difference between these two formats?

  1. String string=args[0];

    String reverse = new StringBuffer(string).reverse().toString();

  2. String string=args[0];

    StringBuffer rev = string.reverse();

    String reverse = rev.toString();

View Answers

Ads









Related Tutorials/Questions & Answers:
StringBuffer
StringBuffer  What's the difference between these two formats? String string=args[0]; String reverse = new StringBuffer(string).reverse().toString(); String string=args[0]; StringBuffer rev = string.reverse(); String
StringBuffer related.
StringBuffer related.  how to make StringBuffer as immutable
Advertisements
StringBuffer and StringBuilder
StringBuffer and StringBuilder  package org.day.strings; import java.io.BufferedReader; public class Test { public static void main(String[] args) { StringBuffer sb1 = new StringBuffer(); sb1.append
Java - StringBuffer class in Java
Java - StringBuffer class in Java       In this example you will learn about StringBuffer class. This example explains how you can use functions provided by the StringBuffer
Creation of StringBuffer
Creation of StringBuffer      ... we have used the following StringBuffer Constructors. StringBuffer() //Default Constructor with 16 characters set StringBuffer(String s) //String to String
String Buffer insert and append example
with StringBuffer and append data to it. The StringBuffer is a class that implements...: StringBuffer(int len): This is the constructor of StringBuffer class... of StringBuffer. It takes following parameters:     pos
String reverse in java
; java API provides StringBuffer and StringBuilder  reverse() method which... StringBuffer and StringBuilder methods. For that we will do it by recursive way as well... String Buffer "); String reverses = new StringBuffer(word1).reverse
Write a method which will remove any given character from a string?
as a replacement of StringBuffer. StringBuilder is not synchronized and uses
How many objects are created in the code below? Explain.
"; StringBuffer s2 = new StringBuffer(s1); StringBuffer s3= s2; StringBuffer s4 = new StringBuffer(s1
explain the difference between string builder and string buffer classes
= "abc"; StringBuffer s2 = new StringBuffer(s1); StringBuffer s3 = s2; StringBuffer s4 = new StringBuffer(s1); } in this example how many objects are created
question
question  can we write calss A extend StringBuffer?   No you cannot extend
string reverse order
){ String s= " kalins naik" ; StringBuffer buffer = new StringBuffer(s...()){ StringBuffer sb= new StringBuffer(st.nextToken()); System.out.print(" "+sb.reverse
(ii) String and String Buffer Class
between String and StringBuffer 1) String object is immutable whereas StringBuffer objects are mutable. 2) String objects are constants
Java - Java Beginners
input=new Scanner(System.in); String str=input.nextLine(); StringBuffer buffer = new StringBuffer(str); StringTokenizer st = new StringTokenizer...(st.hasMoreTokens()){ StringBuffer sb= new StringBuffer(st.nextToken()); System.out.print
Append Function in Java
  You can use the StringBuffer class in Java to efficiently append... the string is appended to the StringBuffer object you can get the final string through calling the toString() on the StringBufferobject. Use StringBuffer is very
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
java fundamental question related to string
java fundamental question related to string  public class Myclass { Public static void main(String args[]) { String s=‚??hello‚??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(‚??a‚
vowels
String:"); String st = input.nextLine(); StringBuffer buffer=new StringBuffer
how to print the following pattern
"; StringBuffer buffer=new StringBuffer(st); for(int i=0;i<st.length();i
Core java
Core java  How to use hyperlink that is href tag in core java without swing, frames etc. My code is StringBuffer oBodyStringBuffer = new StringBuffer("Message Classification: Restricted.\n\n
Appending Strings - Java Tutorials
is the function of StringBuffer. In third task, we will create a StringBuffer...()); } }); System.out.println( "StringBuffer 300 * 10000 additions initial size wrong"); Timer.time(new Runnable() { public void run() { StringBuffer sb = new
Java code for buffer operation...!!!
into the StringBuffer and displayed on console. import java.util.*; class...) { StringBuffer buffer=new StringBuffer(); Scanner input=new Scanner(System.in
Getting the string in reverse
(); StringBuffer buffer=new StringBuffer(); String str[]=st.split... String: "); String st=input.nextLine(); StringBuffer buffer=new StringBuffer(); String str[]=st.split(" "); for(int i=str.length-1
please clarify regarding capacity method of my below string buffer class example
; System.out.println("StringBuffer > insert and append example!"); > StringBuffer sb = new StringBuffer(0); > //First position > System.out.println...: StringBuffer insert and append example! vinoda length is6 capacity is6
cannot find symbol method append(String)
cannot find symbol method append(String)  what is the solution for cannot find symbol method append(String)?   Hi, Check tutorials: How To Append String In Java? Java - StringBuffer class in Java Thanks
cannot find symbol method append(String)
cannot find symbol method append(String)  what is the solution for cannot find symbol method append(String)?   Hi, Check tutorials: How To Append String In Java? Java - StringBuffer class in Java Thanks
java - Java Beginners
=""; StringBuffer sb=new StringBuffer(); StringTokenizer stk=new StringTokenizer
how to convert ACSII to HEX
= str.toCharArray(); StringBuffer hex = new StringBuffer(); for(int
Convert Text File to PDF file
= null; StringBuffer sb = new StringBuffer(""); while ((inLine
automatically break line when ever I put enter.
(); EncryptedMsg = jTextArea2.getText().toString(); StringBuffer sb = new StringBuffer(OriginalMsg); for(int i = 0; i < sb.length(); i
how to convert sql into hql
how to convert sql into hql   StringBuffer questionDataSql = new StringBuffer(); questionDataSql.append( "select...,'') branchingLogic ") .append("FROM question q left join

Ads