Some String's Features

Here you can learn some of the features of the string which help in searching the words as wells.This String is written in Capital S because it’s a separate class can be found in java. The String have many function, it’s an array of the Character .

Some examples of String uses

– Serial numbers which is generated by the help of String .

Let’s start creating a java file named SymbolNo.java


[sourcecode=’java’]
public class SymbolNo {
//———-
//attributes
//———-
String symbol;
String symbol2;

//———–
//CONSTRUCTOR
//———–
public SymbolNo() {
symbol = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
symbol2 = “013479121564568418542458141231654648456484”;
}

//———-
//METHOD
//———-

//method declare to loop and display
public void loopChar(){
for(int i = 0; i<26; i++){ //creating string subStr for creating looped string of symbol2 String subStr = symbol2.substring(i, (i+8)); //displaying symbol System.out.println(subStr + symbol.charAt(i)); } } //MAIN METHOD public static void main (String[] args) { SymbolNo obj = new SymbolNo(); obj.loopChar(); } } [/sourcecode]

Leave a Reply