The java string substring() method returns a part of the string. Strings in Java. Strings in Java fall under the category of Reference/Complex Object data types. Before understanding it, let's first see how to declare a string. code. But in Java, a string is treated like an object that represents a sequence of character values and for that, the string class is used to create a string object. As with any other object, you can create String objects by using the new keyword and a constructor. Note:– Strings are IMMUTABLE objects in Java i.e. For example: For example: public class StringGetBytesExample { public static void main(String args[]){ String s1="ABC"; byte[] b=s1.getBytes(); for(int i=0;i