Developer community
0 votes
1.1k views
asked by Expert (15k points) 15 23 31 | 1.1k views

1 Answer

0 votes
public class Main {
  public static void main(String args[]) {
    String format = "|%1$-10s|%2$10s|%3$-20s|\n";
    System.out.format(format, "A", "AA", "AAA");
    System.out.format(format, "B", "", "BBBBB");
    System.out.format(format, "C", "CCCCC", "CCCCCCCC");
//www . ja va  2 s.c  o m
    String ex[] = { "E", "google.com", "E" };
 
    System.out.format(String.format(format, (Object[]) ex));
  }
}
The code above generates the following result.
|A | AA|AAA |
| | |BBBBB |
| |      CCCCCC| |
| |gooogle.com|E |
 
 
 
answered by Advisor (8.4k points) 10 15 18

Related questions

0 votes
1 answer
asked by felin Advisor (8.4k points) 10 15 18 | 5 views
0 votes
1 answer
asked by felin Advisor (8.4k points) 10 15 18 | 1.1k views
0 votes
1 answer
asked by taye Sr Member (5k points) 7 9 12 | 1.2k views
0 votes
1 answer
0 votes
1 answer
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users