import java.text.MessageFormat; public class ExempleMsgFormat { public static void main(String[] argv) { Object[] params = new Object[] { "Bienvenu", "Paris", "Berne", "Londre" }; System.out.println(MessageFormat.format("{0} � {1}", params)); System.out.println(MessageFormat.format("{0} � {3}", params)); } } /* * Affichage: *- Bienvenu � Paris *- Bienvenu � Londre * */
A voir sur le même Sujet
-
Classe ‘MessageFormat’: Exemple de Format pourcentage
{filelink=5929} import java.text.MessageFormat; public class FormatPoucentage { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Double(123.45), new Double(123.56) …
-
Classe ‘MessageFormat’: Exemple de Format monétaire
{filelink=5928} import java.text.MessageFormat; public class FormatMonnaie { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Double(250.50), new Double(650.15) …
-
Classe ‘MessageFormat’: Formater un Message qui contient un Nombre
{filelink=5924} import java.text.MessageFormat; public class ExempleMsgFormat2 { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Integer(1939), new Integer(1945) …
-
Classe ‘MessageFormat’: Comment combiner la date avec des phrases
{filelink=5937} import java.text.MessageFormat; import java.util.Date; public class AffichageMois { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Date()}; …
-
MessageFormat: Formater un message
{filelink=5925} import java.text.MessageFormat; public class ExempleFomat { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { “Fred”, “Jhon”, “Peter” }; …
-
Classe ‘MessageFormat’: Utiliser un format personnalisé pour l’heure et la Date
{filelink=5935} import java.text.MessageFormat; import java.util.Date; public class HeureFormatPersonnel { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date(), …
-
MessageFormat: Formater un nombre à virgule
{filelink=5927} import java.text.MessageFormat; public class NombreVirgule { public static void main(String[] argv) throws Exception { Object[] params = new Object[] { new Double(3.14), new Double(1234.56) …
-
Classe ‘MessageFormat’: Afficher l’heure en format complet(Ex: 12h30mn GMT)
{filelink=5934} import java.text.MessageFormat; import java.util.Date; public class HeureFormatComplet { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date(), …
-
Modifier les éléments de ‘LinkedList’ à l’aide de la méthode ‘set’.
{filelink=5185} import java.util.LinkedList; public class Ex_LinkedList { public static void main(String[] a) { LinkedList ma_Liste = new LinkedList(); // Ajout des éléments dans la liste …
-
Afficher la date en format moyen
{filelink=5939} import java.text.MessageFormat; import java.util.Date; public class FormatCourt { public static void main(String[] argv) throws Exception { Object[] data = new Object[] { new Date()}; …