Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

Java – Writer to String conversion


package com.beginnersbook.string;
import java.io.StringWriter;

public class WriterToString {
    public static void main(String args[]){
        // create a new writer
          StringWriter sw = new StringWriter();

          // append a char       
          sw.append("abc");
          sw.append(" xyz");
          
          String str = sw.toString();
          System.out.println(str);
    }
}
Output:

abc xyz

asked Jun 11, 2015 in Java Interview Questions by rajesh
0 votes
56 views



Related Hot Questions



Government Jobs Opening


...