add string

an anonymous user · June 24, 2022
import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        String Str2 = "VA2101000045184";
        System.out.println("String Length : " +Str2.length() );
        System.out.println("String 20-Length : " + (20-Str2.length()) );
        if(Str2.length() < 20){
            for(int a= Str2.length() ; a< 20; a++){
                Str2 = Str2 +" ";
            }
            System.out.println("Str2 Str2 : " +Str2 );
            System.out.println("Str2 Str2 : " +Str2.length() );
        }
        
    }
}
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.