java printf tab
Java
String prefix1 = "short text:";
String prefix2 = "looooooooooooooong text:";
String msg = "indented";
/*
* The second string begins after 40 characters. The dash means that the
* first string is left-justified.
*/
String format = "%-40s%s%n";
System.out.printf(format, prefix1, msg);
System.out.printf(format, prefix2, msg);
result:
short text: indented
looooooooooooooong text: indented
Also in Java:
- Title
- java execute for cycle parallel thread
- Category
- Java
- Title
- logger in java
- Category
- Java
- Title
- jagged array java
- Category
- Java
- Title
- how to change actionbar color in android programmatically
- Category
- Java
- Title
- java insertion sort
- Category
- Java
- Title
- java optional to collection
- Category
- Java
- Title
- java new string array
- Category
- Java
- Title
- javafx polygon
- Category
- Java
- Title
- java classes and methods simple logic with comments
- Category
- Java
- Title
- stack class in java
- Category
- Java
- Title
- annotation spring notnull
- Category
- Java
- Title
- hibernate Unknown integral data type for ids : java.lang.String
- Category
- Java
- Title
- how to test for legit email in java
- Category
- Java
- Title
- read from elasticsearch in spark
- Category
- Java
- Title
- how to end a program in an if statement java
- Category
- Java
- Title
- read a file in java and store as integer array using buffered reader
- Category
- Java
- Title
- how to write queries in java
- Category
- Java
- Title
- java print syntax
- Category
- Java
- Title
- string method example in java
- Category
- Java
- Title
- how to check if rs next is null
- Category
- Java
- Title
- how do you make a method that returns an array java
- Category
- Java
- Title
- java variable string
- Category
- Java
- Title
- java array copy
- Category
- Java
- Title
- java for
- Category
- Java
- Title
- init cap java
- Category
- Java
- Title
- biginteger in java
- Category
- Java
- Title
- boolean java.lang.String.equals(java.lang.Object)' on a null object reference
- Category
- Java
- Title
- bootstrap button bigger
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- how to write a java for loop?
- Category
- Java
- Title
- how to create java jframe in eclipse
- Category
- Java
- Title
- mkyong restful web services spring boot examples post
- Category
- Java
- Title
- imageview.setbackground
- Category
- Java
- Title
- java stack push
- Category
- Java
- Title
- calculating the percentile in java
- Category
- Java
- Title
- java 8 add whole array to jsonarray
- Category
- Java
- Title
- how to fix Index 2 out of bounds for length 2 when looping through an array in java
- Category
- Java
- Title
- IN APPLet how to disable a button in java
- Category
- Java
- Title
- get sha key android
- Category
- Java
- Title
- how to remove all items from alist in java
- Category
- Java
- Title
- java getter
- Category
- Java
- Title
- java resource file
- Category
- Java
- Title
- how to make a text field required in android studio
- Category
- Java
- Title
- spigot actionbar
- Category
- Java
- Title
- java observable
- Category
- Java
- Title
- java intercept ctrl c
- Category
- Java
- Title
- how to instanciate map.entry java
- Category
- Java
- Title
- how to select a random element from an array in java
- Category
- Java
- Title
- jframe border
- Category
- Java
- Title
- java random boolean
- Category
- Java
- Title
- creating the functional interface in java
- Category
- Java
- Title
- get day name from date in java
- Category
- Java
- Title
- how to calculate exponential in java
- Category
- Java
- Title
- final variables in java
- Category
- Java
- Title
- loop through array java
- Category
- Java
- Title
- java convert a string to char[]
- Category
- Java
- Title
- fragment manager in android
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- faire un timer en java
- Category
- Java
- Title
- find length of array java
- Category
- Java
- Title
- how to create an abstract method in java
- Category
- Java
- Title
- java time code
- Category
- Java
- Title
- if en une seul ligne java
- Category
- Java
- Title
- java swing dialog box
- Category
- Java
- Title
- java hashmap get value
- Category
- Java
- Title
- java replace all xml decoding
- Category
- Java
- Title
- java arraylist add to top
- Category
- Java
- Title
- how to find the divisors of a number in java
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java command line arguments
- Category
- Java
- Title
- how to count an replace substring string in java
- Category
- Java
- Title
- getordefault java
- Category
- Java
- Title
- array string java in one line
- Category
- Java
- Title
- best companies to workk in
- Category
- Java
- Title
- even or odd in java
- Category
- Java
- Title
- tower of hanoi program in java using recursion
- Category
- Java
- Title
- leap year checker java
- Category
- Java
- Title
- how to initialize main in java
- Category
- Java
- Title
- int java
- Category
- Java
- Title
- java tester si un caractere est une lettre
- Category
- Java
- Title
- convert array of int to arraylist java
- Category
- Java
- Title
- java php object
- Category
- Java
- Title
- java string regexp replace
- Category
- Java
- Title
- bukkit register commands
- Category
- Java
- Title
- hello world in java
- Category
- Java
- Title
- sqrt in java
- Category
- Java
- Title
- Android recycleView
- Category
- Java
- Title
- java sleep in code
- Category
- Java
- Title
- isnumber java
- Category
- Java
- Title
- java how to call getReader twice
- Category
- Java
- Title
- arraylist remove method java
- Category
- Java
- Title
- binary search java
- Category
- Java
- Title
- socket in java
- Category
- Java
- Title
- java enum
- Category
- Java
- Title
- creating random color in java
- Category
- Java
- Title
- throwing exceptions java
- Category
- Java
- Title
- objectoutputstream exemple
- Category
- Java
- Title
- foreach java
- Category
- Java
- Title
- raspberry stackexchange how to install the java jdk
- Category
- Java
- Title
- testing the web layer without authentication spring
- Category
- Java