choiceformatresources.java

来自「its a kind of tutorial.」· Java 代码 · 共 36 行

JAVA
36
字号
// Filename ChoiceFormatResources.java.
// English (UK) resources for the ChoiceFormatDemo program.
//
// Written for JI book, Chapter 9 see text.
// Fintan Culwin, v 0.2, August 1997.


import java.util.ListResourceBundle;
import java.text.*;

public class ChoiceFormatResources extends ListResourceBundle { 

static final double[]     limits = {0,1,2};

static final String       initialPhrases[]  = {"There were ",
                                               "There was ",
                                               "There were "};
static final ChoiceFormat initialFormatter  = 
                                 new ChoiceFormat( limits, initialPhrases);  

static final String       finalPhrases[]  = {" transactions",
                                             " transaction",
                                             " transactions"};
static final ChoiceFormat finalFormatter  = 
                                  new ChoiceFormat( limits, finalPhrases);  

   static final Object[][] contents = {    
      { "initialFormatter", initialFormatter },  
      { "finalFormatter",   finalFormatter   }        
   }; // End contents.
                                     
   public Object[][] getContents() { 
      return contents;   
   } // End getContents.
} // End class ChoiceFormatResources.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?