Java program for String Concatenation.

Akshaya Akki
Published on 09-Feb-2018 10:42:20
The concat() method of the String class concatenates the specified string to the end of this string.Exampleimport java.lang.*; public class StringDemo {    public static void main(String[] args) {       // print str1       String str1 = "self";       System.out.println(str1);           ... Read More

Java String.equals() versus ==.

Sai Nath
Published on 09-Feb-2018 11:45:08
The equals() method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.ExampleLive Demopublic class Sample {    public static void main(String []args) {   ... Read More

How to create String object in Java?

Published on 09-Feb-2018 10:48:52
You can create a String by -Assigning a string value wrapped in " " to a String type variable.String message = "Hello Welcome to Tutorialspoint";Creating an object of the String class using the new keyword by passing the string value as a parameter of its constructor.String message = new String ... Read More

The Optimum Method to Concatenate Strings in Java.

Manikanth Mani
Published on 09-Feb-2018 10:37:14
The Optimum Method to Concatenate Strings in Java is the concat() method.This method 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.ExampleLive Demopublic class ... Read More

How to read the data from a file in Java?

Paul Richard
Published on 09-Feb-2018 10:45:42
The read(byte[] b) method of the FileInputStream class reads up to the b.length from this file input stream to the array of bytes. The method blocks until some input is available.Exampleimport; import; public class Sample {    public static void main(String args[]) throws Exception {       int ... Read More

Java String Concatenation with Other Data Types.

Published on 09-Feb-2018 10:29:04
If you try to concatenate strings using concat() method, you can concat variables of string data type only.To concatenate strings with other data type you need to use the ‘+’ operator.Examplepublic class Test {    public static void main(String args[]){       String st1 = "Hello";       ... Read More

Concatenate Multiple Strings in Java.

Published on 09-Feb-2018 10:25:05
You can concatenate multiple strings using the ‘+’ operator of Java.Examplepublic class Test {    public static void main(String args[]) {       String st1 = "Hello";       String st2 = "How";       String st3 = "You";       String res = st1+st2+st3;   ... Read More

Differences between HashMap and Hashtable in Java

Published on 09-Feb-2018 10:55:20
Hashtable was part of the original java.util and is a concrete implementation of a Dictionary. However, Java 2 re-engineered Hashtable so that it also implements the Map interface. Thus, Hashtable is now integrated into the collections framework. It is similar to HashMap, but is synchronized.Like HashMap, Hashtable stores key/value pairs ... Read More

Java string concat() sample code examples.

Alankritha Ammu
Published on 09-Feb-2018 09:55:12
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

Difference between String class and StringBuffer class in Java

Kumar Varma
Published on 09-Feb-2018 10:41:12
Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects. The Java platform provides the String class to create and manipulate strings.Whereas, StringBuffer class is a thread-safe, mutable sequence of characters.A string buffer is like a String, but ... Read More