Java String concat() method

Manikanth Mani
Published on 09-Feb-2018 14:16:30
The concat() method of the String class appends one String to the end of another. The method returns a String with the value of the String passed into the method, appended to the end of the String, used to invoke this method.Examplepublic class Test {    public static void main(String ... Read More

String Concatenation in Java

Ayyan
Published on 09-Feb-2018 13:11:04
You can concatenate two strings in Java either by using the concat() method or by using the ‘+’ , the “concatenation” operator.The concat() methodThe concat() method appends one String to the end of another. This method returns a String with the value of the String passed into the method, appended ... Read More

Concatenation of Strings in Java

Alankritha Ammu
Published on 09-Feb-2018 13:02:15
You can finish your task by combining/ concatenating your two stings using concat() method or + operator.Exampleimport java.util.Scanner; public class ConncatSample {    public static void main(String []args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter your first name");       String firstName = ... Read More

Different ways to concatenate Strings in Java

Anjana
Published on 09-Feb-2018 12:58:55
You can concatenate two strings in Java either by using the concat() method or by using the ‘+’ , the “concatenation” operator.Examplepublic class ConncatSample {    public static void main(String []args) {       String s1 = "Hello";       String s2 = "world";       String ... Read More

Manipulating Strings in Java.

Manikanth Mani
Published on 09-Feb-2018 12:51:30
Since String class is immutable once created we cannot modify the data of the string. But still if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.Examplepublic class Test {    public static void main(String args[]) {       String str = "Hi welcome ... Read More

Are there any ways to Manipulate Strings in Java.

Ayyan
Published on 09-Feb-2018 12:47:24
Since String class is immutable once created we cannot modify the data of the string. But still, if you want to manipulate string data you can rely on StringBuffer or StringBuilder classes.Examplepublic class Test {    public static void main(String args[]) {       String str = "Hi welcome ... Read More

Java Program to reverse a given String with preserving the position of space.

Akshaya Akki
Published on 09-Feb-2018 12:43:52
You can reverse the contents of a given String using leaving the spaces using the reverse() method of the StringBuffer class.Examplepublic class Test {    public static void main(String args[]) {       String str = "hi welcome to Tutorialspoint";       String strArray[] = str.split(" ");   ... Read More

How to remove the last character from a string in Java?

Alankritha Ammu
Published on 09-Feb-2018 12:41:10
The StringBuffer class contains a method known as deleteCharAt(). This method deletes the character at a specified index/position. You can use this method to delete/remove a particular character from a string in Java.Examplepublic class Test {    public static void main(String args[]){       String str = "hi welcome to ... Read More

How to declare, define and call a method in Java?

Prabhas
Published on 02-Jan-2018 16:23:59
Following is the syntax to declare a method in Java. Syntax modifier return_type method_name(parameters_list){ //method body } Where, modifier − It defines the access type of the method and it is optional to use. return_type − Method may return a value. method_name − This ... Read More

What are the differences between Java classes and Java objects?

Giri Raju
Published on 02-Jan-2018 16:55:41
A class can be defined as a template/blueprint that describes the behaviour/state that the object of its type support. Example public class Dog { String breed; int age; String color; void barking() { ... Read More
Advertisements