Java — Method Chaining in String, StringBuffer & StringBuilder | Code Factory

String s = new String("    Code Factory  ").replace("o", "O").trim();
System.out.println(s);
StringBuffer sb = new StringBuffer("Code Factory").replace(4, 5, "-").append(123);
System.out.println(sb);
StringBuilder sbl = new StringBuilder("Code Factory").replace(4, 6, "-").delete(10, 11);
System.out.println(sbl);
COde FactOry
Code-Factory123
Code-actor

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Architecture: Consider Kron

Azure Functions: durable or non-durable, that is the question!

Fade to black on player death.

Load balancing and sticky sessions in clustering

Avishka Dev — MERN Stack Pr

Full proof method to achieve what you want!!!

How to troubleshoot and fine-tune Service Now Instance Performance

Leetcode Problem 543 Diameter of a Binary tree

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

Factory Method Design Pattern

What is HTTP? and HTTP Request Methods

HTTP Request and Response over Internet

Unary Operator and loops in Java

Chapter 11 — Risky behavior